Add force or replaceIfExists method to composer create method.
Problem to solve
Currently, if you update a branch using the GitLab API, we have to delete the corresponding composer package item each time and then create it again. It would be nice to have a method to replace the composer package that deletes it and creates a new one with the same command, such as force create or replaceIfExists.
For example current behaviour:
#!/bin/bash
# Find package ID for version, example `dev-master`:
PACK_ID = $(curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" 'https://hostname/api/v4/projects/$CI_PROJECT_ID/packages' | jq -c '.[] | select( .version == "dev-master")' | jq .id)
# Destroy the package
curl --request DELETE --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" "https://hostname/api/v4/projects/$CI_PROJECT_ID/packages/$PACK_ID"
# Re-create the package
curl --data branch=master 'https://__token__:$PERSONAL_TOKEN@hostname/api/v4/projects/$CI_PROJECT_ID/packages/composer'
ZD gitlab internal only.
Documentation
https://docs.gitlab.com/ee/user/packages/composer_repository/
Edited by Julius Kvedaras