Add feature to dynamically generate image tags#45
Conversation
This step is in charge to create a random tag for the image service.
5c7d32b to
eff9b1c
Compare
7fa367a to
0ec75b0
Compare
|
Also @DeimerM, we need to update the documentation with this new feature |
Co-authored-by: Maga Giorgianni <maria.jaimes@edunext.co>
Co-authored-by: Maga Giorgianni <maria.jaimes@edunext.co>
Co-authored-by: Maga Giorgianni <maria.jaimes@edunext.co>
Co-authored-by: Maga Giorgianni <maria.jaimes@edunext.co>
Co-authored-by: Maga Giorgianni <maria.jaimes@edunext.co>
|
@DeimerM awesome! can we please also update the readme? I think we could mention this feature in the workflow-overview and also include the inputs in the configuration section |
magajh
left a comment
There was a problem hiding this comment.
LGTM, just a couple of suggestions
This changes was done due to the library that we were using is not the library recommended by python, so we have updated it. Also we fix some single quotes inconsistency.
d4d8e1f to
558d3d4
Compare
This update aims to avoid file I/O operations
558d3d4 to
fc7010e
Compare
|
@Squirrel18 Regarding your additional comment about whether it is valuable to include the Tutor version in each of the images, I’d like to confirm that we discussed this with the team, and we believe it is indeed important for all images to include it. This is because it is the only truly mandatory variable that must be present in the config.yml, and it can be very helpful for operators to determine which version of the Open edX platform and Tutor was used to build the image. |
Squirrel18
left a comment
There was a problem hiding this comment.
Thanks, @DeimerM for this PR. I didn't have much time to review it in depth, but it covers a useful use case. Thanks for taking our case into account!
Problem description:
Initially, this new feature was proposed due to the team's concern that Cirrus Hosting clients could potentially pull images belonging to other clients stored in the shared ECR repository. This raised the need to generate image tags dynamically and, in addition, to append a random alphanumeric suffix to the tags, in order to make the images harder to identify and thus prevent unauthorized downloads.
However, during the development of this PR, a conversation took place with a edunext team, as they had also implemented a similar solution. This led to a broader scope being defined in order to cover more use cases and better meet the needs of the different teams that use the Picasso tool.
Explanation of the new feature:
When the feature developed in this PR is enabled, the image build process for the specified service will skip the tag initially configured in the strain. However, it is still necessary to define an initial image value for the service to be built, since Picasso will use this value to locate the Docker registry and repository name, and it will only modify the tag portion.
Feature configuration and behavior:
To configure this feature, you need to pass the setting
USE_DYNAMIC_IMAGE_TAG: trueto the Picasso job. This will automatically enable tag overwriting and build the image using the newly generated tag.The tag generated by default when this setting is enabled will look like the following: v19.0.3-20250606-1012. This tag is rendered using the following parameters: {tutor_version}-{timestamp}, where the timestamp follows this format: "%Y%m%d-%H%M".
However, along with this feature, it is possible to configure additional parameters in order to generate a more customized tag:
If we inspect the parameters used in the tag, we have the following structure:
tutor_version-prefix + timestamp-random_partwhich corresponds to:{tutor_version}-{prefix}{timestamp}-{random_part}.The prefix and timestamp parameters can be customized by passing the following inputs:
strftimefunction.The
random_partparameter can be enabled by settingUSE_RANDOM_SUFFIXto true. Once activated, a random alphanumeric string will be appended to the end of the tag.Additionally, a feature was added that allows pushing a commit with the new tag to the repository where the strain is located. This functionality was designed for the Cirrus Hosting use case, in order to maintain clear control over the tag of the newly built image.
To use this feature, the job that runs the Picasso workflow must be granted contents: write permissions, and the parameter
UPDATE_REMOTE_CONFIGmust be set to true. It is important to note that this feature will only work if the variableUSE_DYNAMIC_IMAGE_TAGis also enabled.Considerations: It is important to ensure that the
PICASSO_VERSIONparameter is set to a version of Picasso that includes these changes in order for the feature to work properly.An example of a Picasso configuration using these settings can be found below: