Page MenuHomePhabricator

Provide ability to tag GitLab CI built images with a datetime format, set as default in pipeline-to-gitlab conversion
Closed, ResolvedPublic

Description

Using PipelineLib, we get images tagged with a format like 2023-06-06-094537-production.

The .gitlab-ci.yml that we generate using pipeline-to-gitlab tags images with:

  • latest
  • $CI_COMMIT_TAG
  • $CI_COMMIT_SHA

serviceops would prefer that we continue to use the {year}-{month}-{day}-{timestamp}-production format.

Looking at https://gitlab.com/gitlab-org/gitlab/-/issues/22901, I see that there are variables for CI_PIPELINE_CREATED_AT and CI_JOB_STARTED_AT but their format looks like 2021-03-18T04:45:29Z which is invalid (due to colons) for tagging a Docker image.

Resolution

Use this

variables:
  PUBLISH_IMAGE_TAG: $KOKKURI_PIPELINE_TIMESTAMP-$BUILD_VARIANT

Details

TitleReferenceAuthorSource BranchDest Branch
expand setup.tag to $KOKKURI_PIPELINE_TIMESTAMP-$BUILD_VARIANTrepos/releng/pipeline-to-gitlab!3dancyreview/dancy/setup-tagmaster
Use pipeline timestamp and build variant for default image tagrepos/releng/pipeline-to-gitlab!2kharlankharlan-master-patch-39957master
Define KOKKURI_PIPELINE_TIMESTAMP in KOKKURI_DOTENV_PATHrepos/releng/kokkuri!76dancyreview/dancy/pipeline-timestampmain
Add support for tag templatesrepos/releng/kokkuri!75dancyreview/dancy/tags-date-templatemain
gitlab: Use date format for tagged imagesrepos/mediawiki/services/ipoid!5kharlangitlab-use-datemain
Customize query in GitLab

Event Timeline

Specifically, what we want is:

  • that image tags are obviously sortable in chronological order.
  • that the tagging format is consistent across all repositories and all images

I would consider this as a blocker to get images built in gitlab running in the wikikube cluster.

I think we could do something like export CI_IMAGE_PUBLISH_DATE=$(date +"%Y-%m-%d-%H%M%S"-$BUILD_VARIANT) in https://gitlab.wikimedia.org/repos/releng/kokkuri/-/blob/main/includes/images.yaml#L90.

dancy changed the task status from Open to In Progress.Jun 15 2023, 10:27 PM
dancy claimed this task.
dancy triaged this task as Medium priority.

You can use something like this now:

variables:
  PUBLISH_IMAGE_TAG: $KOKKURI_PIPELINE_TIMESTAMP-$BUILD_VARIANT

Change 933096 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[operations/deployment-charts@master] ipoid: Use date/time image version name

https://gerrit.wikimedia.org/r/933096

dancy updated the task description. (Show Details)

Change 933096 merged by jenkins-bot:

[operations/deployment-charts@master] ipoid: Use date/time image version name

https://gerrit.wikimedia.org/r/933096