PingCAP-QE / ci

Continue intergration tests
Apache License 2.0
19 stars 97 forks source link

refactor(jenkins/pipelines,pipelines): use the new dockerfile url location #2960

Closed wuhuizuo closed 1 month ago

wuhuizuo commented 1 month ago

Reverts PingCAP-QE/ci#2959

ti-chi-bot[bot] commented 1 month ago

I have already done a preliminary review for you, and I hope to help you do a better job.

From the pull request, it looks like the change is to update the Dockerfile URL location in various pipeline files. The change suggests using the new URL location for the Dockerfile.

There don't seem to be any potential issues with this change, since it is only an update to the URL location and does not affect the code itself.

However, one suggestion to make is to ensure that the new URL location is correct and accessible. It would be good to test the URLs to make sure they work and update them if needed.

Another suggestion is to consider using variables or constants to store the URL locations, so that they can be easily updated in the future if needed.

Overall, this seems like a simple and straightforward change that should not cause any issues.

ti-chi-bot[bot] commented 1 month ago

I have already done a preliminary review for you, and I hope to help you do a better job.

Based on the pull request title and description, it seems that the changes are related to using a new Dockerfile URL location for Jenkins pipelines. Specifically, the changes in the docker-common.groovy file involve modifying the way the BASE_IMG argument is passed to Docker build commands. This is achieved by adding an additional_args variable that is used to store the --build-arg BASE_IMG argument if it is present in the params variable.

The changes in other files involve updating the URLs for Dockerfiles to use the new location.

Overall, the changes seem straightforward and should not introduce any issues. However, there are a few things that could be improved:

  1. The additional_args variable could be defined using a template string to make the code more readable.
  2. The script could check if the DOCKERFILE variable is empty before attempting to download the Dockerfile.
  3. The if statements checking for the presence of BASE_IMG and RELEASE_TAG could be combined into a single check using an && operator.

Here's an example of how the code in the docker-common.groovy file could be improved:

+ def additional_args = ""
+ if (params.BASE_IMG) {
+     additional_args += " --build-arg BASE_IMG=${params.BASE_IMG}"
+ }
+ 
+ sh """
+ cd monitoring/
+ mv Dockerfile Dockerfile.bak || true
+-curl -C - --retry 5 --retry-delay 6 --retry-max-time 60 -o Dockerfile ${DOCKERFILE}
++if [ -n "$DOCKERFILE" ]; then
++    curl -C - --retry 5 --retry-delay 6 --retry-max-time 60 -o Dockerfile ${DOCKERFILE}
++fi
+ cat Dockerfile
+-docker build --pull  -t ${imagePlaceHolder} . --build-arg BASE_IMG=${params.BASE_IMG}
++docker build --pull  -t ${imagePlaceHolder} .${additional_args}
+ """

Similar changes could be made to the other files in the pull request.

ti-chi-bot[bot] commented 1 month ago

I have already done a preliminary review for you, and I hope to help you do a better job.

Based on the pull request, the key changes are:

There do not appear to be any potential problems with this pull request.

Suggestions:

ti-chi-bot[bot] commented 1 month ago

I have already done a preliminary review for you, and I hope to help you do a better job.

Based on the PR title and description, this PR is about refactoring the Jenkins pipelines to use a new Dockerfile URL location by reverting changes made in a previous PR (2959).

The main changes in the diff are:

There are no potential problems that I could identify. However, here are some suggestions:

Overall, the changes seem reasonable and should improve the maintainability of the pipelines.

wuhuizuo commented 1 month ago

/approve

wuhuizuo commented 1 month ago

/approve

ti-chi-bot[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wuhuizuo

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: - ~~[jenkins/OWNERS](https://github.com/PingCAP-QE/ci/blob/main/jenkins/OWNERS)~~ [wuhuizuo] - ~~[pipelines/OWNERS](https://github.com/PingCAP-QE/ci/blob/main/pipelines/OWNERS)~~ [wuhuizuo] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment