Skip to content

Instantly share code, notes, and snippets.

@Noordsestern
Created July 18, 2023 21:43
Show Gist options
  • Save Noordsestern/b463b366f1e86eac32949aa318f20c94 to your computer and use it in GitHub Desktop.
Save Noordsestern/b463b366f1e86eac32949aa318f20c94 to your computer and use it in GitHub Desktop.
Gitlab-Job for notifying Humanitec about new image
# IMAGE_NAME and IMAGE_TAG must be defined before - you had been using it in your docker-build step
# HUMANITEC_ORG is name of your org in Humanitec
# HUMANITEC_TOKEN that you defined under "Api Tokens" in Humanitec
Notify Humanitec About New Image:
image: curlimages/curl:latest
stage: .post
script:
- echo "Sending ${IMAGE_NAME}:${IMAGE_TAG} to Humanitec"
- >
curl -v
--request POST "https://api.humanitec.io/orgs/${MY_HUMANITEC_ORG}/artefact-versions"
--header "Authorization: Bearer ${HUMANITEC_TOKEN}"
--header "Content-Type: application/json"
--data-raw '{
"name": "'${IMAGE_NAME}'",
"version": "'${IMAGE_TAG}'",
"type": "container",
"commit": "'${CI_COMMIT_SHA}'",
"ref": "'refs/heads/${CI_COMMIT_REF_NAME}'"
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment