I need to get renkulab container for renku v2 from the container registry of a repo, but I can only sort the list on Name (see Fig below).
I don’t know if I can have any power over the tag of the image that will be built automatically by renku runners, but so far I only have commit hashes, which are not the easiest to sort through.
Can we add an option to sort the built containers by date built/published?
In your .gitlab-ci.yml
file, you can update the docker image tag to also include the branch name.
Before:
script: |
CI_COMMIT_SHA_7=$(echo $CI_COMMIT_SHA | cut -c1-7)
docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7 .
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7
After:
script: |
CI_COMMIT_SHA_7=$(echo $CI_COMMIT_SHA | cut -c1-7)
docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7 --tag CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME .
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
This way you can use the string oadat-read:main
or oadat-read:master
(depending on your repository). Note that the image used for sessions will then depend on what is currently tagged image.
I don’t think we have the resources to change the interface and APIs of the docker registry and/or GitLab, unfortunately.
Thanks! Adding branch name is already a good step forward. I wonder if we can tag it with current date somehow, because that would be a suitable work around for me.
script: |
CI_COMMIT_SHA_7=$(echo $CI_COMMIT_SHA | cut -c1-7)
TODAY=$(echo $CI_JOB_STARTED_AT | cut -c1-10)
docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7 --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME --tag $CI_REGISTRY_IMAGE:$TODAY .
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA_7
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
docker push $CI_REGISTRY_IMAGE:$TODAY
Note that maybe this should be adapted so that the date tag is only pushed from the default branch.
1 Like