mirror of
https://github.com/kubereboot/kured.git
synced 2026-08-19 03:16:23 +00:00
build: changed developer toolkit management from shell script to mise
Signed-off-by: Dharsan Baskar <git@dharsanb.com>
This commit is contained in:
@@ -23,5 +23,6 @@ jobs:
|
||||
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@56339e523c0409420f6c2c9a2f4292bbb3c07dd3 # v4.8.0
|
||||
|
||||
@@ -35,6 +35,10 @@ jobs:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
@@ -58,9 +62,6 @@ jobs:
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
id: tags
|
||||
|
||||
- name: Setup GoReleaser
|
||||
run: make bootstrap-tools
|
||||
|
||||
- name: Build binaries
|
||||
run: make kured-release-snapshot
|
||||
env:
|
||||
@@ -78,11 +79,11 @@ jobs:
|
||||
|
||||
- name: Generate SBOM
|
||||
run: |
|
||||
hack/bin/syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }} -o spdx > kured.sbom
|
||||
syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }} -o spdx > kured.sbom
|
||||
|
||||
- name: Sign and attest artifacts
|
||||
run: |
|
||||
hack/bin/cosign sign -y -r ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|
||||
hack/bin/cosign sign-blob -y --output-signature kured.sbom.sig --output-certificate kured.sbom.pem kured.sbom
|
||||
hack/bin/cosign attest -y --type spdx --predicate kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|
||||
hack/bin/cosign attach sbom --type spdx --sbom kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|
||||
cosign sign -y -r ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|
||||
cosign sign-blob -y --output-signature kured.sbom.sig --output-certificate kured.sbom.pem kured.sbom
|
||||
cosign attest -y --type spdx --predicate kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|
||||
cosign attach sbom --type spdx --sbom kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
|
||||
|
||||
@@ -16,8 +16,9 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Link Checker
|
||||
uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2
|
||||
uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2 # v2.6.1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
with:
|
||||
|
||||
@@ -15,13 +15,20 @@ jobs:
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Ensure go version
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: run tests
|
||||
run: make test
|
||||
|
||||
- name: Annotate tests
|
||||
if: always()
|
||||
uses: guyarb/golang-test-annoations@2941118d7ef622b1b3771d1ff6eae9e90659eb26 # v0.8.0
|
||||
@@ -29,7 +36,7 @@ jobs:
|
||||
test-results: test.json
|
||||
|
||||
# This should not be made a mandatory test
|
||||
# It is only used to make us aware of any potential security failure, that
|
||||
# It is only used to make us aware of any potential security failure that
|
||||
# should trigger a bump of the image in build/.
|
||||
pr-vuln-scan:
|
||||
name: Build image and scan it against known vulnerabilities
|
||||
@@ -41,22 +48,30 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Ensure go version
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
- name: Setup GoReleaser
|
||||
run: make bootstrap-tools
|
||||
|
||||
- name: Find current tag version
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
id: tags
|
||||
|
||||
- name: Build image
|
||||
run: VERSION="${{ steps.tags.outputs.sha_short }}" DH_ORG="${{ github.repository_owner }}" make image
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8
|
||||
with:
|
||||
@@ -96,25 +111,27 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Ensure go version
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
- name: Setup GoReleaser
|
||||
run: make bootstrap-tools
|
||||
|
||||
- name: Find current tag version
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
id: tags
|
||||
- name: Install kind
|
||||
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
|
||||
with:
|
||||
install_only: true
|
||||
version: v0.30.0
|
||||
|
||||
- name: Run specific e2e tests
|
||||
run: make e2e-test ARGS="-run ^${{ matrix.testname }}/${{ matrix.kubernetes_version }}"
|
||||
|
||||
@@ -136,28 +153,26 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Ensure go version
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
- name: Setup GoReleaser
|
||||
run: make bootstrap-tools
|
||||
|
||||
- name: Find current tag version
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
id: tags
|
||||
- name: Install kind
|
||||
uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
|
||||
with:
|
||||
install_only: true
|
||||
version: v0.30.0
|
||||
# Keep this until v1.31 (or superior) becomes the default kubectl version for the kind-action.
|
||||
# It is used in podblocker shell script test to use --all-pods.
|
||||
# If the podblocker e2e test relies on another way, this can also be removed.
|
||||
kubectl_version: v1.31.0
|
||||
|
||||
- name: Run specific e2e tests
|
||||
run: make e2e-test ARGS="-run ^${{ matrix.testname }}"
|
||||
|
||||
@@ -30,29 +30,36 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Ensure go version
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: Find current tag version
|
||||
run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
id: tags
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
- name: Setup GoReleaser
|
||||
run: make bootstrap-tools
|
||||
|
||||
- name: Build binaries
|
||||
run: make kured-release-tag
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build single image for scan
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: false
|
||||
load: true
|
||||
tags: |
|
||||
@@ -93,11 +100,11 @@ jobs:
|
||||
|
||||
- name: Generate SBOM
|
||||
run: |
|
||||
hack/bin/syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }} -o spdx > kured.sbom
|
||||
syft ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }} -o spdx > kured.sbom
|
||||
|
||||
- name: Sign and attest artifacts
|
||||
run: |
|
||||
hack/bin/cosign sign -y -r ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
|
||||
hack/bin/cosign sign-blob -y --output-signature kured.sbom.sig kured.sbom
|
||||
hack/bin/cosign attest -y --type spdx --predicate kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
|
||||
hack/bin/cosign attach sbom --type spdx --sbom kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
|
||||
cosign sign -y -r ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
|
||||
cosign sign-blob -y --output-signature kured.sbom.sig kured.sbom
|
||||
cosign attest -y --type spdx --predicate kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
|
||||
cosign attach sbom --type spdx --sbom kured.sbom ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.version }}
|
||||
|
||||
@@ -14,10 +14,13 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
- name: checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: run tests
|
||||
run: make test
|
||||
|
||||
- name: Annotate tests
|
||||
if: always()
|
||||
uses: guyarb/golang-test-annoations@2941118d7ef622b1b3771d1ff6eae9e90659eb26 # v0.8.0
|
||||
@@ -55,6 +58,7 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Link Checker
|
||||
uses: lycheeverse/lychee-action@885c65f3dc543b57c898c8099f4e08c8afd178a2
|
||||
env:
|
||||
@@ -73,20 +77,27 @@ jobs:
|
||||
egress-policy: audit
|
||||
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Ensure go version
|
||||
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
check-latest: true
|
||||
|
||||
- uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1
|
||||
with:
|
||||
version: 2025.10.5
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
|
||||
- name: Setup GoReleaser
|
||||
run: make bootstrap-tools
|
||||
|
||||
- name: Find current tag version
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
id: tags
|
||||
|
||||
- name: Build artifacts
|
||||
run: VERSION="${{ steps.tags.outputs.sha_short }}" DH_ORG="${{ github.repository_owner }}" make image
|
||||
- name: Run Trivy vulnerability scanner
|
||||
|
||||
@@ -4,4 +4,3 @@ build
|
||||
dist
|
||||
test.json
|
||||
tests/kind/testfiles/*.yaml
|
||||
hack/bin/
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[tools]
|
||||
cosign = "2.2.3"
|
||||
golangci-lint = "2.1.6"
|
||||
goreleaser = "1.24.0"
|
||||
kind = "0.30.0"
|
||||
kubectl = "1.31.0"
|
||||
shellcheck = "0.11.0"
|
||||
syft = "1.0.1"
|
||||
+31
-30
@@ -19,7 +19,7 @@ particular makes sense if you are planning to contribute code.
|
||||
|
||||

|
||||
|
||||
The core team has access to Goland from [JetBrains][JetBrains], thanks to their sponsorship. Huge thanks to them.
|
||||
The core team has access to Goland from [JetBrains][JetBrains]. Huge thanks to them for their sponsorship!
|
||||
|
||||
You can use the IDE you prefer. Don't include anything from your IDE in the .gitignore. Please do so in your global .gitignore.
|
||||
|
||||
@@ -27,23 +27,24 @@ You can use the IDE you prefer. Don't include anything from your IDE in the .git
|
||||
|
||||
### Basic binaries required
|
||||
|
||||
Your system needs at the least the following binaries installed:
|
||||
Your system needs at least the following binaries installed:
|
||||
|
||||
- make
|
||||
- sed
|
||||
- find
|
||||
- bash (command, echo)
|
||||
- docker (for docker buildx)
|
||||
- kind
|
||||
- go (see version in go.mod)
|
||||
- go (see the required version in go.mod)
|
||||
- mise (to manage developer tools. See [mise installation instructions](https://mise.jdx.dev/installing-mise.html).)
|
||||
|
||||
### Fetch the additional binaries required
|
||||
|
||||
Please run `make bootstrap-tools` once on a fresh repository clone to download several needed tools, e.g. GoReleaser.
|
||||
Please run `make install-tools` once on a fresh repository clone to download necessary developer tools.
|
||||
Installed tools are listed in [.mise directory](.mise/config.toml).
|
||||
|
||||
### Configure your git for the "Certificate of Origin"
|
||||
|
||||
By contributing to this project you agree to the Developer Certificate of
|
||||
By contributing to this project, you agree to the Developer Certificate of
|
||||
Origin (DCO). This document was created by the Linux Kernel community and is a
|
||||
simple statement that you, as a contributor, have the legal right to make the
|
||||
contribution.
|
||||
@@ -64,17 +65,17 @@ you can sign your commit automatically with `git commit -s`.
|
||||
All Kured repositories are kept under <https://github.com/kubereboot>. To find the code and work on the individual pieces that make Kured, here is our overview:
|
||||
|
||||
| Repositories | Contents |
|
||||
| --------------------------------------- | ------------------------- |
|
||||
|-----------------------------------------|---------------------------|
|
||||
| <https://github.com/kubereboot/kured> | Kured operator itself |
|
||||
| <https://github.com/kubereboot/charts> | Helm chart |
|
||||
| <https://github.com/kubereboot/website> | website and documentation |
|
||||
|
||||
We use github actions in all our repositories.
|
||||
We use GitHub Actions in all our repositories.
|
||||
|
||||
### Charts repo structure highlights
|
||||
|
||||
- we use github actions to do the chart testing. Only linting/installation happens, no e2e test is done.
|
||||
- charts/kured is the place to contribute changes to the chart. Please bump Chart.yaml at each change according to semver.
|
||||
- We use GitHub Actions to do the chart testing. Only linting/installation happens, no e2e test is done.
|
||||
- [charts/kured](https://github.com/kubereboot/charts/tree/main/charts/kured) is the place to contribute changes to the chart. Please bump [Chart.yaml](https://github.com/kubereboot/charts/blob/main/charts/kured/Chart.yaml) at each change according to semver.
|
||||
|
||||
### Kured repo structure highlights
|
||||
|
||||
@@ -91,7 +92,7 @@ We also have other tests:
|
||||
- golangci-lint , shellcheck
|
||||
- a security check against our base image (alpine)
|
||||
|
||||
All these test run on every PR/tagged release. See .github/workflows for more details.
|
||||
All these tests are run on every PR/tagged release. See [.github/workflows](.github/workflows) for more details.
|
||||
|
||||
We use [GoReleaser to build](.goreleaser.yml).
|
||||
|
||||
@@ -104,7 +105,7 @@ At each new major release of kubernetes, we update our dependencies.
|
||||
Beware that whenever we want to update e.g. the `kubectl` or `client-go` dependencies, some other impactful changes might be necessary too.
|
||||
(RBAC, drain behaviour changes, ...)
|
||||
|
||||
As examples, this is what it took to support:
|
||||
A few examples of what it took to support:
|
||||
|
||||
- Kubernetes 1.10 <https://github.com/kubereboot/kured/commit/b3f9ddf> + <https://github.com/kubereboot/kured/commit/bc3f28d> + <https://github.com/kubereboot/kured/commit/908998a> + <https://github.com/kubereboot/kured/commit/efbb0c3> + <https://github.com/kubereboot/kured/commit/5731b98>
|
||||
- Kubernetes 1.14 <https://github.com/kubereboot/kured/pull/75>
|
||||
@@ -112,7 +113,7 @@ As examples, this is what it took to support:
|
||||
|
||||
Search the git log for inspiration for your cases.
|
||||
|
||||
In general the following activities have to happen:
|
||||
In general, the following activities have to happen:
|
||||
|
||||
- Bump kind and its images (see below)
|
||||
- `go get k8s.io/kubectl@v0.{version}`
|
||||
@@ -130,31 +131,31 @@ This will make the full test matrix updated (the CI and the test code).
|
||||
Once your code passes all tests, update the support matrix in
|
||||
the [installation docs](https://kured.dev/docs/installation/).
|
||||
|
||||
Beware that sometimes you also need to update kind version. grep in the .github/workflows for the kind version.
|
||||
Beware that sometimes you also need to update the Kind version. grep in the [.github/workflows](.github/workflows) for the kind version.
|
||||
|
||||
### Updating other dependencies
|
||||
|
||||
Dependabot proposes changes in our `go.mod`/`go.sum`.
|
||||
Some of those changes are covered by CI testing, some are not.
|
||||
CI testing covers some of those changes, but not all.
|
||||
|
||||
Please make sure to test those not covered by CI (mostly the integration
|
||||
with other tools) manually before merging.
|
||||
|
||||
In all cases, review dependabot changes: Imagine all changes as a possible supply chain
|
||||
attack vector. You then need to review the proposed changes by dependabot, and evaluate the trust/risks.
|
||||
attack vector. You then need to review the proposed changes by dependabot and evaluate the trust/risks.
|
||||
|
||||
### Review periodic jobs
|
||||
|
||||
We run periodic jobs (see also Automated testing section of this documentation).
|
||||
Those should be monitored for failures.
|
||||
|
||||
If a failure happen in periodics, something terribly wrong must have happened
|
||||
If a failure happens in periodic testing, something terribly wrong must have happened
|
||||
(or GitHub is failing at the creation of a kind cluster). Please monitor those
|
||||
failures carefully.
|
||||
|
||||
## Testing kured
|
||||
|
||||
If you have developped anything (or just want to take kured for a spin!), run the following tests.
|
||||
If you have developed anything (or just want to take kured for a spin!), run the following tests.
|
||||
As they will run in CI, we will quickly catch if you did not test before submitting your PR.
|
||||
|
||||
### Linting
|
||||
@@ -187,7 +188,7 @@ Then login to a node and run:
|
||||
sudo touch /var/run/reboot-required
|
||||
```
|
||||
|
||||
Then tell us about everything that went well or went wrong in slack.
|
||||
Then tell us about everything that went well or went wrong in Slack.
|
||||
|
||||
#### Testing with `minikube`
|
||||
|
||||
@@ -216,7 +217,7 @@ minikube logs -f
|
||||
|
||||
Now check for the 'Commanding reboot' message and minikube going down.
|
||||
|
||||
Unfortunately as of today, you are going to run into
|
||||
Unfortunately, as of today, you are going to run into
|
||||
<https://github.com/kubernetes/minikube/issues/2874>. This means that
|
||||
minikube won't come back easily. You will need to start minikube again.
|
||||
Then you can check for the lock release.
|
||||
@@ -246,8 +247,8 @@ You can automate the test with `kind` by using the same code as the CI.
|
||||
make e2e-test
|
||||
```
|
||||
|
||||
You can alter test behaviour by passing arguments to this command.
|
||||
A few examples below:
|
||||
You can alter the test behaviour by passing arguments to this command.
|
||||
A few examples are given below:
|
||||
|
||||
```shell
|
||||
# Run only TestE2EWithSignal test for the kubernetes version named "current" (see kind file)
|
||||
@@ -278,26 +279,26 @@ In the charts PR, you can directly bump the `appVersion` to the next minor versi
|
||||
For example, if current `appVersion` is `1.6.x`, make sure you update your `appVersion`
|
||||
to `1.7.0`). It allows us to have an easy view of what we land each release.
|
||||
|
||||
Do not hesitate to increase the test coverage for your feature, whether it's unit
|
||||
testing to full functional testing (even using helm charts).
|
||||
Do not hesitate to increase the test coverage for your feature, whether it's unit testing
|
||||
to full functional testing (even using helm charts).
|
||||
|
||||
The team of kured is small, so we will most likely refuse any feature adding maintenance burden.
|
||||
|
||||
## Introducing changes in the helm chart
|
||||
|
||||
When you change the helm chart, do not forget to bump its version according to semver.
|
||||
When you change the helm chart, remember to bump its version according to semver.
|
||||
Changes to defaults are frowned upon unless absolutely necessary.
|
||||
|
||||
## Introducing new tests / increase test coverage
|
||||
## Introducing new tests / increasing test coverage
|
||||
|
||||
At the opposite of features, we welcome ALL features increasing our stability and test coverage.
|
||||
On the opposite of features, we welcome ALL features increasing our stability and test coverage.
|
||||
See also our GitHub issues with the label [`testing`](https://github.com/kubereboot/kured/labels/testing).
|
||||
|
||||
## Publishing a new kured release
|
||||
|
||||
### Double check the latest kubernetes patch version
|
||||
### Double-check the latest kubernetes patch version
|
||||
|
||||
Ensure you have used the latest patch version in tree.
|
||||
Ensure you have used the latest patch version in the tree.
|
||||
Check the documentation "Updating k8s support" if the minor version was not yet applied.
|
||||
|
||||
### Update the manifests with the new version
|
||||
@@ -323,7 +324,7 @@ cat kured-ds.yaml >> "$MANIFEST"
|
||||
### Create the new version tag on the repo (optional, can also be done directly in GH web interface)
|
||||
|
||||
Tag the previously created commit with the future release version.
|
||||
The Github Actions workflow will push the new image to the registry.
|
||||
The GitHub Actions workflow will push the new image to the registry.
|
||||
|
||||
### Publish new version release artifacts
|
||||
|
||||
|
||||
@@ -1,40 +1,31 @@
|
||||
.DEFAULT: all
|
||||
.PHONY: all clean image minikube-publish manifest test kured-all lint
|
||||
|
||||
HACKDIR=./hack/bin
|
||||
GORELEASER_CMD=$(HACKDIR)/goreleaser
|
||||
DH_ORG ?= kubereboot
|
||||
VERSION=$(shell git rev-parse --short HEAD)
|
||||
SUDO=$(shell docker info >/dev/null 2>&1 || echo "sudo -E")
|
||||
|
||||
all: image
|
||||
|
||||
$(HACKDIR):
|
||||
mkdir -p $(HACKDIR)
|
||||
|
||||
.PHONY: bootstrap-tools
|
||||
bootstrap-tools: $(HACKDIR)
|
||||
command -v $(HACKDIR)/goreleaser || VERSION=v1.24.0 TMPDIR=$(HACKDIR) bash hack/installers/goreleaser-install.sh
|
||||
command -v $(HACKDIR)/syft || curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b $(HACKDIR) v1.0.1
|
||||
command -v $(HACKDIR)/cosign || curl -sSfL https://github.com/sigstore/cosign/releases/download/v2.2.3/cosign-linux-amd64 -o $(HACKDIR)/cosign
|
||||
command -v $(HACKDIR)/shellcheck || (curl -sSfL https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz | tar -J -v -x shellcheck-stable/shellcheck && mv shellcheck-stable/shellcheck $(HACKDIR)/shellcheck && rmdir shellcheck-stable)
|
||||
chmod +x $(HACKDIR)/goreleaser $(HACKDIR)/cosign $(HACKDIR)/syft $(HACKDIR)/shellcheck
|
||||
command -v $(HACKDIR)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(HACKDIR) v2.1.6
|
||||
.PHONY: install-tools
|
||||
install-tools:
|
||||
command -v mise 2>&1 || { echo "please install mise to continue" >&2; exit 127; }
|
||||
mise install
|
||||
|
||||
clean:
|
||||
rm -rf ./dist
|
||||
|
||||
kured: bootstrap-tools
|
||||
$(GORELEASER_CMD) build --clean --single-target --snapshot
|
||||
kured:
|
||||
goreleaser build --clean --single-target --snapshot
|
||||
|
||||
kured-all: bootstrap-tools
|
||||
$(GORELEASER_CMD) build --clean --snapshot
|
||||
kured-all:
|
||||
goreleaser build --clean --snapshot
|
||||
|
||||
kured-release-tag: bootstrap-tools
|
||||
$(GORELEASER_CMD) release --clean
|
||||
kured-release-tag:
|
||||
goreleaser release --clean
|
||||
|
||||
kured-release-snapshot: bootstrap-tools
|
||||
$(GORELEASER_CMD) release --clean --snapshot
|
||||
kured-release-snapshot:
|
||||
goreleaser release --clean --snapshot
|
||||
|
||||
image: kured
|
||||
$(SUDO) docker buildx build --no-cache --load -t ghcr.io/$(DH_ORG)/kured:$(VERSION) .
|
||||
@@ -67,11 +58,15 @@ manifest:
|
||||
echo "Please generate combined manifest if necessary"
|
||||
|
||||
test: lint
|
||||
echo "Running short go tests"
|
||||
@echo "Running short go tests"
|
||||
go test -test.short -json ./... > test.json
|
||||
|
||||
lint: bootstrap-tools
|
||||
echo "Running shellcheck"
|
||||
find . -name '*.sh' | xargs -n1 $(HACKDIR)/shellcheck
|
||||
lint:
|
||||
@echo "Running shellcheck"
|
||||
find . -name '*.sh' | xargs -n1 shellcheck
|
||||
@echo "Running golangci-lint..."
|
||||
$(HACKDIR)/golangci-lint run ./...
|
||||
golangci-lint run ./...
|
||||
|
||||
lint-docs:
|
||||
@echo "Running lychee"
|
||||
mise x lychee@latest -- lychee --verbose --no-progress '*.md' '*.yaml' '*/*/*.go' --exclude-link-local
|
||||
@@ -1,30 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
RELEASES_URL="https://github.com/goreleaser/goreleaser/releases"
|
||||
FILE_BASENAME="goreleaser"
|
||||
|
||||
test -z "$VERSION" && {
|
||||
echo "Unable to get goreleaser version." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
test -z "$TMPDIR" && TMPDIR="$(mktemp -d)"
|
||||
# goreleaser uses arm64 instead of aarch64
|
||||
goreleaser_arch=$(uname -m | sed -e 's/aarch64/arm64/g' -e 's/ppc64le/ppc64/' -e 's/armv7l/armv7/' )
|
||||
TAR_FILE="$TMPDIR/${FILE_BASENAME}_$(uname -s)_${goreleaser_arch}.tar.gz"
|
||||
export TAR_FILE
|
||||
|
||||
(
|
||||
echo "Downloading GoReleaser $VERSION..."
|
||||
curl -sfLo "$TAR_FILE" \
|
||||
"$RELEASES_URL/download/$VERSION/${FILE_BASENAME}_$(uname -s)_${goreleaser_arch}.tar.gz"
|
||||
cd "$TMPDIR"
|
||||
curl -sfLo "checksums.txt" "$RELEASES_URL/download/$VERSION/checksums.txt"
|
||||
echo "Verifying checksums..."
|
||||
sha256sum --ignore-missing --quiet --check checksums.txt
|
||||
)
|
||||
|
||||
tar -xf "$TAR_FILE" -O goreleaser > "$TMPDIR/goreleaser"
|
||||
rm "$TMPDIR/checksums.txt"
|
||||
rm "$TAR_FILE"
|
||||
Reference in New Issue
Block a user