Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Automate updating weekly version #689

Merged
merged 5 commits into from
Oct 21, 2021

Conversation

timja
Copy link
Member

@timja timja commented Oct 21, 2021

  • Automate updating weekly version
  • Downgrade weekly for testing on CI

@timja timja added the chore Reduces future maintenance label Oct 21, 2021
Comment on lines 17 to 21
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.JENKINS_DEPENDENCY_UPDATER_APP_ID }}
private_key: ${{ secrets.JENKINS_DEPENDENCY_UPDATER_PRIVATE_KEY }}
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we cannot use the standard $GITHUB_TOKEN?

Copy link
Member Author

Choose a reason for hiding this comment

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

We had an issue with it in the helm-charts repo, something to do with other workflows not starting correctly, we had to always push a new commit or re-run all jobs. May be ok in a repo not using github actions.

There was another issue IIRC about it committing as the last user to commit to the main branch but that's probably fixed by specifying the bot details

Copy link
Contributor

Choose a reason for hiding this comment

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

As per https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow:

When you use the repository's GITHUB_TOKEN to perform tasks on behalf of the GitHub Actions app, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs. For example, if a workflow run pushes code using the repository's GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur.

We had to create a technical user on https://github.com/updatecli/ to avoid this problem (PR opened but no workflow triggered).

Copy link
Member

Choose a reason for hiding this comment

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

events triggered by the GITHUB_TOKEN will not create a new workflow run

Fine…why would we care here? Our only push-triggered action is a Jenkins build.

Copy link
Member

Choose a reason for hiding this comment

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

I join @jglick if we can rely on a GITHUB_TOKEN, I think it's better as we don't have to rotate that password.

Copy link
Member Author

Choose a reason for hiding this comment

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

the credentials are managed centrally here, so doesn't really make much difference but yeah sure will switch when I get a chance later on

@@ -14,7 +14,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<bom>weekly</bom>
<jenkins.version>2.317</jenkins.version>
<jenkins.version>2.316</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

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

Why? Just to see if the workflow will bump it back up again?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

updatecli/updatecli.d/weekly-apply.sh Show resolved Hide resolved
.github/workflows/updatecli.yaml Outdated Show resolved Hide resolved
Comment on lines 27 to 34
flags: "--config ./updatecli/updatecli.d --values updatecli/values.yaml"
env:
UPDATECLI_GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

- name: Apply
uses: updatecli/updatecli-action@v1
with:
flags: "--config ./updatecli/updatecli.d --values updatecli/values.yaml"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
flags: "--config ./updatecli/updatecli.d --values updatecli/values.yaml"
env:
UPDATECLI_GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Apply
uses: updatecli/updatecli-action@v1
with:
flags: "--config ./updatecli/updatecli.d --values updatecli/values.yaml"
flags: "--config updatecli/updatecli.d --values updatecli/values.yaml"
env:
UPDATECLI_GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: Apply
uses: updatecli/updatecli-action@v1
with:
flags: "--config updatecli/updatecli.d --values updatecli/values.yaml"

?

Copy link
Contributor

Choose a reason for hiding this comment

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

I vote for starting with ./: it helps when reading (or getting started) to undertsand that it's a file path relative to the working dir

Copy link
Member

@olblak olblak Oct 21, 2021

Choose a reason for hiding this comment

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

Is there any other reason than just eye habit? I am more used to './' than nothing.

Copy link
Contributor

@dduportal dduportal left a comment

Choose a reason for hiding this comment

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

2 feedbacks :) But good idea and thanks for doing it!

- name: Diff
uses: updatecli/updatecli-action@v1
with:
command: diff
Copy link
Contributor

Choose a reason for hiding this comment

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

@timja is there a reason to perform a diff in this workflow? I understand that the "apply" is always performed so it seems redundant?

On other github.com/jenkins-infra/jenkins-infra repositories:

Copy link
Member Author

Choose a reason for hiding this comment

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

I just copied this out of the github workflow guide on updatecli.io

Copy link
Member Author

Choose a reason for hiding this comment

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

updatecli/updatecli.d/weekly-apply.sh Show resolved Hide resolved
Copy link
Member

@olblak olblak left a comment

Choose a reason for hiding this comment

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

Once the other feedbacks have been implemented, this PR seems to good to me

@timja timja requested review from jglick and jetersen October 21, 2021 20:18
@timja timja merged commit f5ebb50 into jenkinsci:master Oct 21, 2021
@timja timja deleted the automate-updating-weekly-version branch October 21, 2021 20:36
@timja
Copy link
Member Author

timja commented Oct 21, 2021

It's not working because maven and java aren't in the update cli docker image.
I'll take a look tomorrow probably switching to sed commands I guess

unless anyone has any better ideas

@dduportal
Copy link
Contributor

dduportal commented Oct 21, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Reduces future maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants