Skip to content

Commit 296c351

Browse files
authored
fix: Backport 2208 to v15 (#2213)
Signed-off-by: matttrach <matt.trachier@suse.com>
1 parent 4e5d376 commit 296c351

10 files changed

Lines changed: 318 additions & 92 deletions

File tree

.envrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ if ! which "$0" | grep -q nix; then
4343
fi
4444

4545
echo 'Installing Nix Profile...'
46-
if ! nf profile install . --profile "$profile"; then
47-
echo 'Failed to install new Nix profile! Reverting to previous profile...'
46+
if ! nf profile add . --profile "$profile"; then
47+
echo 'Failed to add new Nix profile! Reverting to previous profile...'
4848
git checkout flake.lock
49-
nf profile install . --profile "$profile"
49+
nf profile add . --profile "$profile"
5050
fi
5151

5252
nf profile list --profile "$profile"

.github/workflows/manual-rc-release.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,21 @@ on:
1313
description: 'The rc tag to create, e.g. v1.2.3-rc.1'
1414
required: true
1515

16-
permissions:
17-
contents: write
18-
id-token: write
19-
issues: write
20-
pull-requests: write
21-
actions: read
16+
env:
17+
NIX_INSTALL_SHA: de490f61fcbaf9a5cabf2fa621ddb9ef93ad35d9a23a04e7d51b26e092b63691
18+
NIX_INSTALL_VERSION: 2.34.4
19+
20+
permissions: {}
2221

2322
jobs:
2423
rc-release:
2524
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
id-token: write
28+
issues: write
29+
pull-requests: write
30+
actions: read
2631
steps:
2732
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/commits/main
2833
id: check-user-in-maintainers
@@ -113,15 +118,35 @@ jobs:
113118
go-version-file: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.mod
114119
cache-dependency-path: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.sum
115120
cache: true
121+
- name: install-nix
122+
run: |
123+
curl -L -o install.sh "https://releases.nixos.org/nix/nix-${NIX_INSTALL_VERSION}/install"
124+
echo "${NIX_INSTALL_SHA} install.sh" | sha256sum -c -
125+
chmod +x install.sh
126+
./install.sh
127+
source /home/runner/.nix-profile/etc/profile.d/nix.sh
128+
nix --version
129+
which nix
116130
- name: Run GoReleaser
117-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
118-
with:
119-
args: release --clean --skip=validate --config ../../.goreleaser_rc.yml
120-
workdir: ${{ github.workspace }}/tags/${{ inputs.tag }}
131+
shell: /home/runner/.nix-profile/bin/nix develop --ignore-environment --extra-experimental-features nix-command --extra-experimental-features flakes --keep TAG --keep GPG_KEY_ID --keep GPG_PASSPHRASE --keep HOME --keep SSH_AUTH_SOCK --keep GITHUB_TOKEN --keep NIX_SSL_CERT_FILE --keep NIX_ENV_LOADED --keep TERM --command bash -e {0}
121132
env:
122133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123134
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
124135
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
136+
TAG: ${{ inputs.tag }}
137+
run: |-
138+
cd ${{ github.workspace }}/tags/$TAG
139+
goreleaser release --clean --skip=validate --config ../../.goreleaser_rc.yml
140+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
141+
echo "Missing required file: dist/metadata.json"
142+
exit 1
143+
fi
144+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
145+
echo "Missing required file: dist/artifacts.json"
146+
exit 1
147+
fi
148+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
149+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
125150
- name: 'Find Issues and Create Comments'
126151
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script
127152
env:

.github/workflows/manual-release.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,19 @@ on:
1010
description: 'The commit SHA to create the tag from, defaults to HEAD of the selected branch.'
1111
required: false
1212

13-
permissions:
14-
contents: write
15-
id-token: write
16-
actions: read
13+
env:
14+
NIX_INSTALL_SHA: de490f61fcbaf9a5cabf2fa621ddb9ef93ad35d9a23a04e7d51b26e092b63691
15+
NIX_INSTALL_VERSION: 2.34.4
16+
17+
permissions: {}
1718

1819
jobs:
1920
release:
2021
runs-on: ubuntu-latest
22+
permissions:
23+
contents: write
24+
id-token: write
25+
actions: read
2126
steps:
2227
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/commits/main
2328
id: check-user-in-maintainers
@@ -106,12 +111,32 @@ jobs:
106111
go-version-file: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.mod
107112
cache-dependency-path: ${{ github.workspace }}/tags/${{ inputs.tag }}/go.sum
108113
cache: true
114+
- name: install-nix
115+
run: |
116+
curl -L -o install.sh "https://releases.nixos.org/nix/nix-${NIX_INSTALL_VERSION}/install"
117+
echo "${NIX_INSTALL_SHA} install.sh" | sha256sum -c -
118+
chmod +x install.sh
119+
./install.sh
120+
source /home/runner/.nix-profile/etc/profile.d/nix.sh
121+
nix --version
122+
which nix
109123
- name: Run GoReleaser
110-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
111-
with:
112-
args: release --clean --skip=validate --config ../../.goreleaser.yml
113-
workdir: ${{ github.workspace }}/tags/${{ inputs.tag }}
124+
shell: /home/runner/.nix-profile/bin/nix develop --ignore-environment --extra-experimental-features nix-command --extra-experimental-features flakes --keep HOME --keep SSH_AUTH_SOCK --keep TAG --keep GPG_KEY_ID --keep GPG_PASSPHRASE --keep GITHUB_TOKEN --keep NIX_SSL_CERT_FILE --keep NIX_ENV_LOADED --keep TERM --command bash -e {0}
114125
env:
115126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
116127
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
117128
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
129+
TAG: ${{ inputs.tag }}
130+
run: |-
131+
cd ${{ github.workspace }}/tags/$TAG
132+
goreleaser release --clean --skip=validate --config ../../.goreleaser.yml
133+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
134+
echo "Missing required file: dist/metadata.json"
135+
exit 1
136+
fi
137+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
138+
echo "Missing required file: dist/artifacts.json"
139+
exit 1
140+
fi
141+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
142+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"

.github/workflows/release.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,14 +408,33 @@ jobs:
408408
409409
echo "Importing gpg key"
410410
echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; }
411+
- name: install-nix
412+
run: |
413+
curl -L -o install.sh "https://releases.nixos.org/nix/nix-${NIX_INSTALL_VERSION}/install"
414+
echo "${NIX_INSTALL_SHA} install.sh" | sha256sum -c -
415+
chmod +x install.sh
416+
./install.sh
417+
source /home/runner/.nix-profile/etc/profile.d/nix.sh
418+
nix --version
419+
which nix
411420
- name: Run GoReleaser
412-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
413-
with:
414-
args: release --clean --config .goreleaser_rc.yml
421+
shell: /home/runner/.nix-profile/bin/nix develop --ignore-environment --extra-experimental-features nix-command --extra-experimental-features flakes --keep HOME --keep SSH_AUTH_SOCK --keep GPG_KEY_ID --keep GPG_PASSPHRASE --keep GITHUB_TOKEN --keep NIX_SSL_CERT_FILE --keep NIX_ENV_LOADED --keep TERM --command bash -e {0}
415422
env:
416423
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
417424
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
418425
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
426+
run: |-
427+
goreleaser release --clean --config .goreleaser_rc.yml
428+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
429+
echo "Missing required file: dist/metadata.json"
430+
exit 1
431+
fi
432+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
433+
echo "Missing required file: dist/artifacts.json"
434+
exit 1
435+
fi
436+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
437+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
419438
- name: 'Find Issues and Create Comments'
420439
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script
421440
env:
@@ -473,11 +492,30 @@ jobs:
473492
474493
echo "Importing gpg key"
475494
echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; }
495+
- name: install-nix
496+
run: |
497+
curl -L -o install.sh "https://releases.nixos.org/nix/nix-${NIX_INSTALL_VERSION}/install"
498+
echo "${NIX_INSTALL_SHA} install.sh" | sha256sum -c -
499+
chmod +x install.sh
500+
./install.sh
501+
source /home/runner/.nix-profile/etc/profile.d/nix.sh
502+
nix --version
503+
which nix
476504
- name: Run GoReleaser
477-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action
478-
with:
479-
args: release --clean --config .goreleaser.yml
505+
shell: /home/runner/.nix-profile/bin/nix develop --ignore-environment --extra-experimental-features nix-command --extra-experimental-features flakes --keep HOME --keep SSH_AUTH_SOCK --keep GPG_KEY_ID --keep GPG_PASSPHRASE --keep GITHUB_TOKEN --keep NIX_SSL_CERT_FILE --keep NIX_ENV_LOADED --keep TERM --command bash -e {0}
480506
env:
481507
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
482508
GPG_KEY_ID: ${{ env.GPG_KEY_ID }}
483509
GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }}
510+
run: |-
511+
goreleaser release --clean --config .goreleaser.yml
512+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
513+
echo "Missing required file: dist/metadata.json"
514+
exit 1
515+
fi
516+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
517+
echo "Missing required file: dist/artifacts.json"
518+
exit 1
519+
fi
520+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
521+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"

aspell_custom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pre-release
1919
prerelease
2020
rancher
2121
rc
22+
readme
2223
rke
2324
rke2
2425
sha

examples/use-cases/one/README.md

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,38 @@ This shows the most basic use case for the provider, is functions as a good star
77
## Dependencies
88

99
The `flake.nix` file in the root of the module explains all of the dependencies for the development of the module, it also includes the dependencies to run it.
10-
You can see the list on lines 50-80, but a more specific list is below (with explanations).
10+
You can see the list on lines 143-174, but a more specific list is below (with explanations).
1111

12-
- bash -> born again shell with linux core utils facilitates CLI actions
13-
- tfswitch -> handy for installing Terraform at specific verisons
14-
- git -> required by Terraform
15-
- curl -> required by Terraform as well as dependent modules (when downloading RKE2 for install)
16-
- openssh -> required by Terraform and used in dependent modules to connect to servers for initial configuration
17-
- openssl -> required by Terraform and used in dependent modules to verify TLS certificates
18-
- ssh-agent -> used for connecting to remote server for initial configuration, you need to have the key you send into the module loaded in your agent
12+
- actionlint -> used to lint workflows
13+
- aspellWithDicts -> used to validate commit messages
14+
- awscli2 -> used in some dependent modules in some use cases (dualstack)
15+
- bashInteractive -> born again shell with linux core utils facilitates CLI actions
16+
- cmctl -> helpful to troubleshoot Rancher install issues
17+
- curl -> required for Terraform
18+
- eslint -> lint node scripts in CI
1919
- gh -> the github cli tool, used to find releases when downloading RKE2 for install
20-
- jq -> json parsing tool, used in dependent modules to parse submodule outputs
21-
- kubectl -> used in local exec to patch kubernetes objects
22-
- awscli2 -> the aws cli tool, used in some dependent modules in some use cases (dualstack)
23-
- yq -> yaml parsing tool, used in dependent modules to parse kubectl outputs
24-
- go -> necessary to run tests
20+
- git -> required by Terraform
21+
- gitleaks -> used in CI to detect potential key leaks
22+
- gnupg -> helpful when generating a new gpg key for releases
23+
- go -> necessary for building and testing
24+
- golangci-lint -> lint go code
25+
- gotestfmt -> necessary for gotestsum
26+
- gotestsum -> test harness that allows for better parsing and testing of go tests
27+
- kubernetes-helm -> helpful when troubleshooting helm issues
28+
- jq -> used in dependent modules to parse submodule outputs
29+
- kubectl -> necessary when pulling kubeconfig
30+
- less -> helpful when needing to read files
31+
- nodejs_24 -> used by eslint to validate github scripts
32+
- openssh -> necessary to connect to servers
33+
- openssl -> helpful when generating certs
34+
- shellcheck -> used by ci to validate shell scripts
35+
- tflint -> used by ci to validate Terraform examples
36+
- vim -> helpful when editing files
37+
- which -> helpful when troubleshooting nix issues
38+
- yq -> used in dependent modules to parse kubectl outputs
39+
- terraform -> necessary to run tests
40+
- goreleaser -> necessary for releases
41+
- leftovers -> necessary for cleaning up broken tests
2542

2643
## Environment Variables
2744

examples/use-cases/production/README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,38 @@ The TLS certificate is externally generated and publicly verifiable (assuming yo
88
## Dependencies
99

1010
The `flake.nix` file in the root of the module explains all of the dependencies for the development of the module, it also includes the dependencies to run it.
11-
You can see the list on lines 50-80, but a more specific list is below (with explanations).
12-
13-
- bash -> born again shell with linux core utils facilitates CLI actions
14-
- tfswitch -> handy for installing Terraform at specific verisons
15-
- git -> required by Terraform
16-
- curl -> required by Terraform as well as dependent modules (when downloading RKE2 for install)
17-
- openssh -> required by Terraform and used in dependent modules to connect to servers for initial configuration
18-
- openssl -> required by Terraform and used in dependent modules to verify TLS certificates
19-
- ssh-agent -> used for connecting to remote server for initial configuration, you need to have the key you send into the module loaded in your agent
11+
You can see the list on lines 143-174, but a more specific list is below (with explanations).
12+
13+
- actionlint -> used to lint workflows
14+
- aspellWithDicts -> used to validate commit messages
15+
- awscli2 -> used in some dependent modules in some use cases (dualstack)
16+
- bashInteractive -> born again shell with linux core utils facilitates CLI actions
17+
- cmctl -> helpful to troubleshoot Rancher install issues
18+
- curl -> required for Terraform
19+
- eslint -> lint node scripts in CI
2020
- gh -> the github cli tool, used to find releases when downloading RKE2 for install
21-
- jq -> json parsing tool, used in dependent modules to parse submodule outputs
22-
- kubectl -> used in local exec to patch kubernetes objects
23-
- awscli2 -> the aws cli tool, used in some dependent modules in some use cases (dualstack)
24-
- yq -> yaml parsing tool, used in dependent modules to parse kubectl outputs
25-
- go -> necessary to run tests
21+
- git -> required by Terraform
22+
- gitleaks -> used in CI to detect potential key leaks
23+
- gnupg -> helpful when generating a new gpg key for releases
24+
- go -> necessary for building and testing
25+
- golangci-lint -> lint go code
26+
- gotestfmt -> necessary for gotestsum
27+
- gotestsum -> test harness that allows for better parsing and testing of go tests
28+
- kubernetes-helm -> helpful when troubleshooting helm issues
29+
- jq -> used in dependent modules to parse submodule outputs
30+
- kubectl -> necessary when pulling kubeconfig
31+
- less -> helpful when needing to read files
32+
- nodejs_24 -> used by eslint to validate github scripts
33+
- openssh -> necessary to connect to servers
34+
- openssl -> helpful when generating certs
35+
- shellcheck -> used by ci to validate shell scripts
36+
- tflint -> used by ci to validate Terraform examples
37+
- vim -> helpful when editing files
38+
- which -> helpful when troubleshooting nix issues
39+
- yq -> used in dependent modules to parse kubectl outputs
40+
- terraform -> necessary to run tests
41+
- goreleaser -> necessary for releases
42+
- leftovers -> necessary for cleaning up broken tests
2643

2744
## Environment Variables
2845

examples/use-cases/three/README.md

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,38 @@ This module was developed working closely with specific customer feedback.
1313
## Dependencies
1414

1515
The `flake.nix` file in the root of the module explains all of the dependencies for the development of the module, it also includes the dependencies to run it.
16-
You can see the list on lines 50-80, but a more specific list is below (with explanations).
17-
18-
- bash -> born again shell with linux core utils facilitates CLI actions
19-
- tfswitch -> handy for installing Terraform at specific verisons
20-
- git -> required by Terraform
21-
- curl -> required by Terraform as well as dependent modules (when downloading RKE2 for install)
22-
- openssh -> required by Terraform and used in dependent modules to connect to servers for initial configuration
23-
- openssl -> required by Terraform and used in dependent modules to verify TLS certificates
24-
- ssh-agent -> used for connecting to remote server for initial configuration, you need to have the key you send into the module loaded in your agent
16+
You can see the list on lines 143-174, but a more specific list is below (with explanations).
17+
18+
- actionlint -> used to lint workflows
19+
- aspellWithDicts -> used to validate commit messages
20+
- awscli2 -> used in some dependent modules in some use cases (dualstack)
21+
- bashInteractive -> born again shell with linux core utils facilitates CLI actions
22+
- cmctl -> helpful to troubleshoot Rancher install issues
23+
- curl -> required for Terraform
24+
- eslint -> lint node scripts in CI
2525
- gh -> the github cli tool, used to find releases when downloading RKE2 for install
26-
- jq -> json parsing tool, used in dependent modules to parse submodule outputs
27-
- kubectl -> used in local exec to patch kubernetes objects
28-
- awscli2 -> the aws cli tool, used in some dependent modules in some use cases (dualstack)
29-
- yq -> yaml parsing tool, used in dependent modules to parse kubectl outputs
30-
- go -> necessary to run tests
26+
- git -> required by Terraform
27+
- gitleaks -> used in CI to detect potential key leaks
28+
- gnupg -> helpful when generating a new gpg key for releases
29+
- go -> necessary for building and testing
30+
- golangci-lint -> lint go code
31+
- gotestfmt -> necessary for gotestsum
32+
- gotestsum -> test harness that allows for better parsing and testing of go tests
33+
- kubernetes-helm -> helpful when troubleshooting helm issues
34+
- jq -> used in dependent modules to parse submodule outputs
35+
- kubectl -> necessary when pulling kubeconfig
36+
- less -> helpful when needing to read files
37+
- nodejs_24 -> used by eslint to validate github scripts
38+
- openssh -> necessary to connect to servers
39+
- openssl -> helpful when generating certs
40+
- shellcheck -> used by ci to validate shell scripts
41+
- tflint -> used by ci to validate Terraform examples
42+
- vim -> helpful when editing files
43+
- which -> helpful when troubleshooting nix issues
44+
- yq -> used in dependent modules to parse kubectl outputs
45+
- terraform -> necessary to run tests
46+
- goreleaser -> necessary for releases
47+
- leftovers -> necessary for cleaning up broken tests
3148

3249
## Environment Variables
3350

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)