Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Container building pipeline: supports git tags and remove local image info database #724

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

mquhuy
Copy link
Member

@mquhuy mquhuy commented Nov 27, 2023

With this PR, container building script will handle git tags, provided as refs/tags/<tag_name> by github actions. The exact container tags are as followed:

  • If checking a git tag, the only image tag generated will be the tag name
  • If checking a git branch, the following image tags are appointed to the same newly-built image:
    • The branch name. Eg. release-0.4
    • The branch name with date and latest short hash: E.g. release-0.4_20231127_d03da556
    • If the branch is main, tagging it as latest.

Edit: Changed some implementation to take into account new parameters set implemented in https://gerrit.nordix.org/c/infra/cicd/+/20053/3/jjb/metal3/job_container_image_building.yaml. Basically this means no image information will be stored in this repo, but got piped from upstream (jjb configuration)

@mquhuy mquhuy force-pushed the mquhuy/container-build-support-tags branch 2 times, most recently from 8b65b07 to 58c676a Compare November 27, 2023 11:43
Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The array handling is broken + some nits.

@mquhuy mquhuy force-pushed the mquhuy/container-build-support-tags branch 6 times, most recently from cc4786e to 1c73bea Compare November 28, 2023 08:01
@mquhuy
Copy link
Member Author

mquhuy commented Nov 28, 2023

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

@metal3-io-bot
Copy link
Member

@mquhuy: Overrode contexts on behalf of mquhuy: test-integration-metal3-dev-tools-centos, test-integration-metal3-dev-tools-ubuntu

In response to this:

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mquhuy mquhuy force-pushed the mquhuy/container-build-support-tags branch 2 times, most recently from e0a6e16 to ce5ab29 Compare November 29, 2023 08:08
@mquhuy
Copy link
Member Author

mquhuy commented Nov 29, 2023

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

@metal3-io-bot
Copy link
Member

@mquhuy: Overrode contexts on behalf of mquhuy: test-integration-metal3-dev-tools-centos, test-integration-metal3-dev-tools-ubuntu

In response to this:

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

kashifest
kashifest previously approved these changes Dec 1, 2023
Copy link
Contributor

@smoshiur1237 smoshiur1237 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned in one of the GH workflow file PRs that we could pass the information about Dockerfile and image name via the env, instead of maintaining the JSON file in this repo.

Changing it later requires a lot more effort and syncing PRs than fixing it right now. WDYT? @mquhuy @kashifest @lentzi90

@mquhuy
Copy link
Member Author

mquhuy commented Dec 1, 2023

I mentioned in one of the GH workflow file PRs that we could pass the information about Dockerfile and image name via the env, instead of maintaining the JSON file in this repo.

Changing it later requires a lot more effort and syncing PRs than fixing it right now. WDYT? @mquhuy @kashifest @lentzi90

Just for reference, here is the link to @tuminoid 's original comment: metal3-io/baremetal-operator#1456 (comment)

I have put in there some of my ideas, in this thread I can also mention that changing the structure now is not easy, either:

  • We need to add many more params to the jenkins jobs.
  • The jenkins jobs are currently designed to be separated (i.e. each image has one job pipeline). Having them combined is possible, but takes time, and I still think having them separated is better for management.

@tuminoid
Copy link
Member

tuminoid commented Dec 1, 2023

I mentioned in one of the GH workflow file PRs that we could pass the information about Dockerfile and image name via the env, instead of maintaining the JSON file in this repo.
Changing it later requires a lot more effort and syncing PRs than fixing it right now. WDYT? @mquhuy @kashifest @lentzi90

Just for reference, here is the link to @tuminoid 's original comment: metal3-io/baremetal-operator#1456 (comment)

I have put in there some of my ideas, in this thread I can also mention that changing the structure now is not easy, either:

  • We need to add many more params to the jenkins jobs.

The JSON file has 3 parameters: repository, dockerfile location, and repo_name (image name). They are pretty specific per workflow job. You're already passing one of them (image name), so 2 new, and for 95% of the cases, we can default the Dockerfile to be /Dockerfile. Effectively 1 env.

  • The jenkins jobs are currently designed to be separated (i.e. each image has one job pipeline). Having them combined is possible, but takes time, and I still think having them separated is better for management.

I'm not following this argument. I'm suggesting adding 2 more environment variables to the workflow files, and removing the build_image() function (which basically reads the same information from the file as we provided in the env). How would this affect the jenkins jobs in any way?

@mquhuy
Copy link
Member Author

mquhuy commented Dec 1, 2023

  • The jenkins jobs are currently designed to be separated (i.e. each image has one job pipeline). Having them combined is possible, but takes time, and I still think having them separated is better for management.

I'm not following this argument. I'm suggesting adding 2 more environment variables to the workflow files, and removing the build_image() function (which basically reads the same information from the file as we provided in the env). How would this affect the jenkins jobs in any way?

I'm answering your later point first, since it's needed to understand the first point. If you check our jenkins, you will find several jobs in form metal3_<image_name>_container_image_build. Each of them represents a separate container image build.
Now if we wanted to remove the centralized information, we would no longer be able to manage them separately. Each image build would represent one run of the same jenkins job, and we would only know which image got built by checking the run params.

  • We need to add many more params to the jenkins jobs.

The JSON file has 3 parameters: repository, dockerfile location, and repo_name (image name). They are pretty specific per workflow job. You're already passing one of them (image name), so 2 new, and for 95% of the cases, we can default the Dockerfile to be /Dockerfile. Effectively 1 env.

I don't think it's that simple, we should not just care about the number of params, but also their complexity

  • The image name is currently there, but it's the same with the job name (and the job name is the default), so it's hardly mistaken. The only thing you need to care is the branch/tag name. And if, by any reason, someone put in a not supported image name, the job will just fail and no harms will be done, at least nothing will be pushed to quay on our behalf.
  • In a new setup when you use the same job for all builds, even the image name can be a tricky thing to put in, not to mention stuff like url. And remember that the script has no way to check if an image name is legit, it will build and push anything as long as the repo can be cloned and it has a Dockerfile.

@lentzi90
Copy link
Member

lentzi90 commented Dec 4, 2023

I agree with @tuminoid . Getting rid of the json file and using parameters instead makes the logic simpler and the job more generic/re-usable.

In a new setup when you use the same job for all builds, even the image name can be a tricky thing to put in, not to mention stuff like url. And remember that the script has no way to check if an image name is legit, it will build and push anything as long as the repo can be cloned and it has a Dockerfile.

I don't think it has to be all the same job, but even if we do it that way, can you explain why this would be problematic @huy? We pass URLs and names, tags, branches, etc as parameters all the time.

@mquhuy mquhuy changed the title Container building pipeline supports git tags Container building pipeline: supports git tags and remove local image info database Jan 8, 2024
@mquhuy
Copy link
Member Author

mquhuy commented Jan 8, 2024

/test-integration-metal3-dev-tools-ubuntu

Rozzii
Rozzii previously approved these changes Jan 8, 2024
Copy link
Contributor

@Rozzii Rozzii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@Rozzii
Copy link
Contributor

Rozzii commented Jan 8, 2024

/approve

docker push "${image_path}"
docker tag "${image_path}" "${image_latest_path}"
docker push "${image_latest_path}"
# docker push "${image_path}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the docker pushes intentionally commented out?
/hold

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, no. I must have missed it, initially commented it just to test the script. Thanks for the notice :D

@mquhuy mquhuy force-pushed the mquhuy/container-build-support-tags branch from 7f77c35 to 4bb6203 Compare January 8, 2024 11:08
@Rozzii
Copy link
Contributor

Rozzii commented Jan 8, 2024

/ test-integration-metal3-dev-tools-centos
/test-integration-metal3-dev-tools-ubuntu

@Rozzii
Copy link
Contributor

Rozzii commented Jan 8, 2024

/test-integration-metal3-dev-tools-centos

Copy link
Member

@tuminoid tuminoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/unhold

@tuminoid
Copy link
Member

tuminoid commented Jan 9, 2024

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

@metal3-io-bot
Copy link
Member

@tuminoid: Overrode contexts on behalf of tuminoid: test-integration-metal3-dev-tools-centos, test-integration-metal3-dev-tools-ubuntu

In response to this:

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mquhuy
Copy link
Member Author

mquhuy commented Jan 9, 2024

/test-integration-metal3-dev-tools-centos
/test-integration-metal3-dev-tools-ubuntu

@tuminoid
Copy link
Member

tuminoid commented Jan 9, 2024

/test-integration-metal3-dev-tools-centos /test-integration-metal3-dev-tools-ubuntu

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

@metal3-io-bot
Copy link
Member

@tuminoid: Overrode contexts on behalf of tuminoid: test-integration-metal3-dev-tools-centos, test-integration-metal3-dev-tools-ubuntu

In response to this:

/test-integration-metal3-dev-tools-centos /test-integration-metal3-dev-tools-ubuntu

/override test-integration-metal3-dev-tools-centos
/override test-integration-metal3-dev-tools-ubuntu

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Collaborator

@kashifest kashifest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@metal3-io-bot
Copy link
Member

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kashifest, Rozzii, tuminoid

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Rozzii,kashifest,tuminoid]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@metal3-io-bot metal3-io-bot merged commit 72afa4a into main Jan 9, 2024
@metal3-io-bot metal3-io-bot deleted the mquhuy/container-build-support-tags branch January 9, 2024 07:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants