Skip to content

Commit 21cda80

Browse files
Use Hash instead of Branch name to replace go.mod
Before this patch, We were replacing go.mod in openstack-operator with PR commit using branch name. ex: ~~ go mod edit --replace github.com/openstack-k8s-operators/keystone-operator/api@$version= github.com/ysandeep93/keystone-operator/api@dependabot/go_modules/ sigs.k8s.io/controller-runtime-0.13.1 ~~~ After Go 1.13, there is an known issue if we have slashes in branch name.[1] ~~~ $go mod tidy go: errors parsing go.mod: /tmp/openstack-operator/go.mod:97: replace github.com/ysandeep93/keystone-operator/api: version "dependabot/go_modules/sigs.k8s.io/controller-runtime-0.13.1" invalid: version "dependabot/go_modules/sigs.k8s.io/controller-runtime-0.13.1" invalid: disallowed version string ~~~ With this patch, updating our logic to use hash of branch instead of branch name, same workaround/fix is mentioned here[2]. [1] golang/go#32955 [2] golang/go#34175 (comment)
1 parent 62eb7ef commit 21cda80

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.github/workflows/reusable-workflow-e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ jobs:
183183
run: |
184184
pushd ${{ github.workspace }}
185185
version=`cat go.mod | grep -m 1 github.com/openstack-k8s-operators/keystone-operator/api | cut -d ' ' -f2`
186-
go mod edit --replace github.com/openstack-k8s-operators/${{ inputs.operator_name }}/api@$version=github.com/${{github.event.pull_request.head.repo.full_name}}/api@${{ github.head_ref }}
186+
go mod edit --replace github.com/openstack-k8s-operators/${{ inputs.operator_name }}/api@$version=github.com/${{github.event.pull_request.head.repo.full_name}}/api@${{github.event.pull_request.head.sha}}
187187
go mod tidy
188188
cd ./apis/
189-
go mod edit --replace github.com/openstack-k8s-operators/${{ inputs.operator_name }}/api@$version=github.com/${{github.event.pull_request.head.repo.full_name}}/api@${{ github.head_ref }}
189+
go mod edit --replace github.com/openstack-k8s-operators/${{ inputs.operator_name }}/api@$version=github.com/${{github.event.pull_request.head.repo.full_name}}/api@${{github.event.pull_request.head.sha}}
190190
go mod tidy
191191
git diff
192192
popd

0 commit comments

Comments
 (0)