diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/e2e.yaml similarity index 72% rename from .github/workflows/test-e2e.yml rename to .github/workflows/e2e.yaml index 1da94d2..7987490 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/e2e.yaml @@ -1,35 +1,25 @@ -name: E2E Tests - +name: e2e on: - push: pull_request: - jobs: - test-e2e: - name: Run on Ubuntu + test: runs-on: ubuntu-latest steps: - name: Clone the code - uses: actions/checkout@v4 - + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2 - name: Setup Go - uses: actions/setup-go@v5 + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0 with: go-version-file: go.mod - - name: Install the latest version of kind run: | curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 chmod +x ./kind sudo mv ./kind /usr/local/bin/kind - - name: Verify kind installation run: kind version - - name: Create kind cluster run: kind create cluster - - - name: Running Test e2e + - name: Running e2e test run: | - go mod tidy make test-e2e diff --git a/.github/workflows/lint.yml b/.github/workflows/go.yaml similarity index 53% rename from .github/workflows/lint.yml rename to .github/workflows/go.yaml index 739f4cc..e631812 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/go.yaml @@ -1,21 +1,29 @@ -name: Lint - +name: go on: - push: pull_request: - + push: + branches: + - 'main' jobs: lint: - name: Run on Ubuntu 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: Run linter 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 diff --git a/.github/workflows/test-chart.yml b/.github/workflows/helm.yaml similarity index 80% rename from .github/workflows/test-chart.yml rename to .github/workflows/helm.yaml index c59f180..2846acf 100644 --- a/.github/workflows/test-chart.yml +++ b/.github/workflows/helm.yaml @@ -1,68 +1,49 @@ -name: Test Chart - +name: helm on: - push: pull_request: - jobs: - test-e2e: - name: Run on Ubuntu + lint: runs-on: ubuntu-latest steps: - 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 - uses: actions/setup-go@v5 + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 #v6.3.0 with: go-version-file: go.mod - - name: Install the latest version of kind run: | curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 chmod +x ./kind sudo mv ./kind /usr/local/bin/kind - - name: Verify kind installation run: kind version - - name: Create kind cluster run: kind create cluster - - name: Prepare operator run: | - go mod tidy make docker-build IMG=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 run: | helm repo add jetstack https://charts.jetstack.io helm repo update helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true - - name: Wait for cert-manager to be ready 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-cainjector kubectl wait --namespace cert-manager --for=condition=available --timeout=300s deployment/cert-manager-webhook - - name: Install Helm chart for project run: | helm install test-chart --create-namespace --namespace netbird --set 'operator.image.tag=debug' ./helm/kubernetes-operator - - name: Check Helm release status run: | helm status test-chart --namespace netbird - \ No newline at end of file diff --git a/.github/workflows/helm.yml b/.github/workflows/helm.yml deleted file mode 100644 index 6793b0e..0000000 --- a/.github/workflows/helm.yml +++ /dev/null @@ -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 }}" diff --git a/.github/workflows/kubectl-docker.yml b/.github/workflows/kubectl-docker.yml index bbaf92d..dae05da 100644 --- a/.github/workflows/kubectl-docker.yml +++ b/.github/workflows/kubectl-docker.yml @@ -8,7 +8,6 @@ on: - "v*" branches: - main - pull_request: jobs: kubectl-docker: diff --git a/.github/workflows/docker.yml b/.github/workflows/release.yaml similarity index 65% rename from .github/workflows/docker.yml rename to .github/workflows/release.yaml index f0a67e1..8a5f82f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/release.yaml @@ -1,52 +1,39 @@ -name: Docker - +name: release on: push: tags: - "v*" branches: - main - pull_request: - jobs: - release: + docker: runs-on: ubuntu-latest permissions: contents: read packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. id-token: write - steps: - name: Docker meta id: meta - uses: docker/metadata-action@v5 + uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf #v6.0.0 with: - # list of Docker images to use as base name for tags images: | netbirdio/kubernetes-operator - # generate Docker tags based on the following events/attributes tags: | type=ref,event=pr type=ref,event=branch type=semver,pattern={{version}} - - name: Login to Docker Hub - if: github.repository == github.event.pull_request.head.repo.full_name || !github.head_ref - uses: docker/login-action@v3 + uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 #v4.0.0 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_TOKEN }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - + uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a #v4.0.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd #v4.0.0 - name: Build and push - uses: docker/build-push-action@v6 + uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 #v7.0.0 with: platforms: linux/amd64,linux/arm64 push: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index fc2e80d..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -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