Hi,
as discussed in #20420 this is an attempt to automate Docker upgrades for the CI environment. I say attempt, because I can't really test it in the real setup, so forgive me if things are not working. If they are, it should open a PR for version 19.03.8.
Let me know what you think. Cheers, Christoph
Comment From: mbhave
Here's what I was thinking. detect-docker-updates.sh
would look a lot like what you currently have except for line 33 (which tries to push to the git repo) and lines 36-43. For line 33, the push could be done in the pipeline.yml
. We do something similar when staging a release. In this case, stage-git-repo
is an output of the stage
task which has the extra commit.
Following the put
to the git repo in the pipeline.yml
, we could have another task which creates the PR. This task would call a script that contains the curl
command in lines 36-43. The creation of the PR would be conditional on the branch differing from master
(or 2.2.x
/2.1.x
).
Here's what the pipeline.yml
might look like:
- task: detect-docker-updates
file: git-repo/ci/tasks/detect-docker-updates.yml
params:
BRANCH: ((branch)) [1]
GITHUB_REPO: spring-boot
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
image: spring-boot-ci-image
- put: git-repo-ci-docker [2]
params:
repository: docker-updates-git-repo
force: true
- task: create-pull-request
file: git-repo/ci/tasks/create-pull-request.yml
params:
BRANCH: ((branch))
GITHUB_REPO: spring-boot
GITHUB_ORGANIZATION: spring-projects
GITHUB_PASSWORD: ((github-password))
GITHUB_USERNAME: ((github-username))
[1] git-repo-ci-docker
would be another resource
in pipeline.yml
which points to the branch we want to push to.
- name: git-repo-ci-docker
type: git
icon: github-circle
source:
uri: ((github-repo))
username: ((github-username))
password: ((github-password))
branch: ci-docker-((branch))
[2] branch would be the branch configured in [1].
If this is still confusing and I can see how it can be because it is hard to test, I can prepare a branch with your PR and the changes I mentioned on top of that. Let me know what works best for you.
Comment From: dreis2211
Yeah, it's kind of hard if it can't be tested really. But I will give it a try - I have a way better idea now of what you were thinking. Will do so over the weekend, I guess. Thanks, @mbhave
Comment From: dreis2211
I pushed an updated version, but the Concourse git-repo configs still confuse me. Their naming is simply not intuitive to me, sorry. I'm not happy with this PR - I can't really test the setup and it feels like doing open heart surgery with a blindfold on. I need help, @mbhave
Comment From: mbhave
@dreis2211 Thanks so much for updating this and sorry this is such a pain to test :( I will take a look at the updated PR today.
Comment From: dreis2211
No need to be sorry.
Comment From: mbhave
@dreis2211 I made a few minor changes to your PR here. I think this will work now. If you're okay with the changes, I can squash your commits, add mine on top and merge. We'll find out if it does work :)
Comment From: dreis2211
@mbhave I'm okay with whatever you suggest
Comment From: dreis2211
I guess it didn't work
Comment From: mbhave
It did with a few minor changes. The create pull request task was missing the image configuration and I had missed a cd
when I added something in my polish commit.
Comment From: mbhave
Thanks for the PR @dreis2211!
Comment From: dreis2211
@mbhave The PR was created but it seems to be empty. Thoughts?
Comment From: mbhave
@dreis2211 I just realized that too. It had the right commit the first time I ran it. When I ran it again, it detected that a PR already exists and force pushed the existing master
branch to the ci-docker-image
branch. Effectively, the PR branch and master then became the same and GitHub thought the PR was merged.
I think if we remove this if
condition and commit to ci-docker-image
regardless of if a PR exists, it will keep the ci-docker-image
branch up-to-date with master
along with that additional commit on top.
We can then move that if
condition to the create-pull-request.sh
script.
Comment From: dreis2211
Seems like a plan. Sorry, that you have additional work with this PR. Let me know if I should open a PR for the suggested changes, but I think it's simpler if you do them directly
Comment From: mbhave
No problem! I hadn't anticipated this case. Anyway, I ran the pipeline twice and it seems to work now even when a PR exists. Thanks again!