mirror of
https://github.com/YuzuZensai/netbird-kubernetes-operator.git
synced 2026-09-13 10:49:15 +00:00
Cleanup workflows and pin action versions (#118)
This change does some cleanup of the actions workflows to makes them faster to run and easier to debug. It pins all of the actions workflows to specific commit hashes. Dependabot will be enabled in a separate PR to manage updates. Signed-off-by: Philip Laine <philip.laine@gmail.com>
This commit is contained in:
@@ -1,35 +1,25 @@
|
|||||||
name: E2E Tests
|
name: e2e
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-e2e:
|
test:
|
||||||
name: Run on Ubuntu
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone the code
|
- name: Clone the code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Install the latest version of kind
|
- name: Install the latest version of kind
|
||||||
run: |
|
run: |
|
||||||
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
|
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
|
||||||
chmod +x ./kind
|
chmod +x ./kind
|
||||||
sudo mv ./kind /usr/local/bin/kind
|
sudo mv ./kind /usr/local/bin/kind
|
||||||
|
|
||||||
- name: Verify kind installation
|
- name: Verify kind installation
|
||||||
run: kind version
|
run: kind version
|
||||||
|
|
||||||
- name: Create kind cluster
|
- name: Create kind cluster
|
||||||
run: kind create cluster
|
run: kind create cluster
|
||||||
|
- name: Running e2e test
|
||||||
- name: Running Test e2e
|
|
||||||
run: |
|
run: |
|
||||||
go mod tidy
|
|
||||||
make test-e2e
|
make test-e2e
|
||||||
@@ -1,21 +1,29 @@
|
|||||||
name: Lint
|
name: go
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
name: Run on Ubuntu
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone the code
|
- name: Clone the code
|
||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||||
|
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Run linter
|
- name: Run linter
|
||||||
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 #v9.2.0
|
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 #v9.2.0
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone the code
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
- name: Running Tests
|
||||||
|
run: make test
|
||||||
@@ -1,68 +1,49 @@
|
|||||||
name: Test Chart
|
name: helm
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-e2e:
|
lint:
|
||||||
name: Run on Ubuntu
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone the code
|
- name: Clone the code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||||
|
- name: Lint Helm Chart
|
||||||
|
run: helm lint ./helm/kubernetes-operator
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Clone the code
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
||||||
- name: Setup Go
|
- name: Setup Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
|
||||||
- name: Install the latest version of kind
|
- name: Install the latest version of kind
|
||||||
run: |
|
run: |
|
||||||
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
|
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
|
||||||
chmod +x ./kind
|
chmod +x ./kind
|
||||||
sudo mv ./kind /usr/local/bin/kind
|
sudo mv ./kind /usr/local/bin/kind
|
||||||
|
|
||||||
- name: Verify kind installation
|
- name: Verify kind installation
|
||||||
run: kind version
|
run: kind version
|
||||||
|
|
||||||
- name: Create kind cluster
|
- name: Create kind cluster
|
||||||
run: kind create cluster
|
run: kind create cluster
|
||||||
|
|
||||||
- name: Prepare operator
|
- name: Prepare operator
|
||||||
run: |
|
run: |
|
||||||
go mod tidy
|
|
||||||
make docker-build IMG=netbirdio/kubernetes-operator:debug
|
make docker-build IMG=netbirdio/kubernetes-operator:debug
|
||||||
kind load docker-image netbirdio/kubernetes-operator:debug
|
kind load docker-image netbirdio/kubernetes-operator:debug
|
||||||
|
|
||||||
- name: Install Helm
|
|
||||||
run: |
|
|
||||||
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
|
|
||||||
|
|
||||||
- name: Verify Helm installation
|
|
||||||
run: helm version
|
|
||||||
|
|
||||||
- name: Lint Helm Chart
|
|
||||||
run: |
|
|
||||||
helm lint ./helm/kubernetes-operator
|
|
||||||
|
|
||||||
- name: Install cert-manager via Helm
|
- name: Install cert-manager via Helm
|
||||||
run: |
|
run: |
|
||||||
helm repo add jetstack https://charts.jetstack.io
|
helm repo add jetstack https://charts.jetstack.io
|
||||||
helm repo update
|
helm repo update
|
||||||
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
|
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
|
||||||
|
|
||||||
- name: Wait for cert-manager to be ready
|
- name: Wait for cert-manager to be ready
|
||||||
run: |
|
run: |
|
||||||
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
|
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager
|
||||||
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
|
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-cainjector
|
||||||
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
|
kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook
|
||||||
|
|
||||||
- name: Install Helm chart for project
|
- name: Install Helm chart for project
|
||||||
run: |
|
run: |
|
||||||
helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/kubernetes-operator
|
helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/kubernetes-operator
|
||||||
|
|
||||||
- name: Check Helm release status
|
- name: Check Helm release status
|
||||||
run: |
|
run: |
|
||||||
helm status test-chart --namespace netbird
|
helm status test-chart --namespace netbird
|
||||||
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
name: Release Helm Chart
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
paths:
|
|
||||||
# update this file to trigger helm chart release
|
|
||||||
- 'helm/kubernetes-operator/Chart.yaml'
|
|
||||||
- 'helm/netbird-operator-config/Chart.yaml'
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
chart-release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
CHART_BASE_DIR: helm
|
|
||||||
GH_PAGES_BRANCH: gh-pages
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
pages: write
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3.1.0
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Configure Git
|
|
||||||
run: |
|
|
||||||
git config user.name "$GITHUB_ACTOR"
|
|
||||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
||||||
|
|
||||||
- name: Install Helm
|
|
||||||
uses: azure/setup-helm@v3.4
|
|
||||||
with:
|
|
||||||
version: v3.4.2
|
|
||||||
|
|
||||||
- name: Run chart-releaser
|
|
||||||
uses: helm/chart-releaser-action@v1.4.1
|
|
||||||
with:
|
|
||||||
charts_dir: helm
|
|
||||||
env:
|
|
||||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
||||||
CR_RELEASE_NAME_TEMPLATE: "helm-{{ .Name }}-v{{ .Version }}"
|
|
||||||
@@ -8,7 +8,6 @@ on:
|
|||||||
- "v*"
|
- "v*"
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
kubectl-docker:
|
kubectl-docker:
|
||||||
|
|||||||
@@ -1,52 +1,39 @@
|
|||||||
name: Docker
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
# This is used to complete the identity challenge
|
|
||||||
# with sigstore/fulcio when running outside of PRs.
|
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf #v6.0.0
|
||||||
with:
|
with:
|
||||||
# list of Docker images to use as base name for tags
|
|
||||||
images: |
|
images: |
|
||||||
netbirdio/kubernetes-operator
|
netbirdio/kubernetes-operator
|
||||||
# generate Docker tags based on the following events/attributes
|
|
||||||
tags: |
|
tags: |
|
||||||
type=ref,event=pr
|
type=ref,event=pr
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.repository == github.event.pull_request.head.repo.full_name || !github.head_ref
|
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 #v4.0.0
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_TOKEN }}
|
password: ${{ secrets.DOCKER_TOKEN }}
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a #v4.0.0
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd #v4.0.0
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 #v7.0.0
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
name: Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Run on Ubuntu
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Clone the code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version-file: go.mod
|
|
||||||
|
|
||||||
- name: Running Tests
|
|
||||||
run: |
|
|
||||||
go mod tidy
|
|
||||||
make test
|
|
||||||
Reference in New Issue
Block a user