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

[CI] UpdateCLI: Added go mod tidy #41170

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/bump-golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ jobs:
strategy:
fail-fast: false
matrix:
file: ['bump-golang.yml', 'bump-golang-7.17.yml']
file: ["bump-golang.yml", "bump-golang-7.17.yml"]
pazone marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v4

- name: Install Updatecli in the runner
uses: updatecli/updatecli-action@6b8881a17fc8038e884ec94ff72a49e8e8a4069f # v0.76.1

- uses: actions/setup-go@v5
with:
go-version-file: .go-version
Comment on lines +28 to +30
Copy link
Member

Choose a reason for hiding this comment

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

Will this cause any issues if the golang-bump happens afterwards? Let's say current version is 1.22.7 and the upcoming one is 1.22.8, hence this step will point to 1.22.7 but the updatecli pipeline will move the version from 1.22.7 to 1.22.8

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. It's better to install the new version of go.

Copy link
Member

@v1v v1v Oct 10, 2024

Choose a reason for hiding this comment

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

Hence, this change will not install the new version if that's the pre-req

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updatecli can neither execute a specified target nor run a subset of targets. I came up with one solution that I don't like.

  1. run updatecli with --commit false --push false. It applies the changes to the target files.
  2. install go with GHA using updated .go-version
  3. run updatecli again without --commit false --push false and it pushes the changes.

Please check the updates. Do you have any ideas on how can we make it in one execution?

Copy link
Member

@v1v v1v Oct 23, 2024

Choose a reason for hiding this comment

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

First, can you explain the motivation for running go mod tidy? I have not seen the need to use it while running the same mechanism with other golang versions:

Updatecli can neither execute a specified target nor run a subset of targets.

As far as I see there is a parameter called dependson, see https://www.updatecli.io/docs/core/target/#_parameters:

"dependson" allows to specify the order of execution of resources It accepts a list of rules like "(resourceType#)resourceId(:booleanOperator)" The resourceType is optional and can be one of "condition", "source" or "target"


- name: Run Updatecli in Apply mode
run: updatecli --experimental apply --config .github/workflows/updatecli.d/${{ matrix.file }} --values .github/workflows/updatecli.d/values.d/scm.yml
env:
Expand All @@ -33,7 +37,7 @@ jobs:
- if: ${{ failure() }}
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
with:
channel-id: '#ingest-notifications'
channel-id: "#ingest-notifications"
Copy link
Member

Choose a reason for hiding this comment

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

ditto

payload: |
{
"text": "${{ env.SLACK_MESSAGE }}",
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/updatecli.d/bump-golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ targets:
content: 'go {{ source "gomod" }}'
file: go.mod
matchpattern: 'go \d+.\d+.\d+'
goModTidy:
dependson:
- update-gomod
disablesourceinput: true
kind: shell
name: Run `go mod tidy`
spec:
changedif:
kind: file/checksum
spec:
files:
- go.mod
- go.sum
command: go mod tidy
update-go-version:
name: "Update .go-version"
sourceid: latestGoVersion
Expand Down
Loading