diff --git a/.github/workflows/build_and_push.yaml b/.github/workflows/ci.yaml similarity index 53% rename from .github/workflows/build_and_push.yaml rename to .github/workflows/ci.yaml index 696a306..219324a 100644 --- a/.github/workflows/build_and_push.yaml +++ b/.github/workflows/ci.yaml @@ -1,14 +1,28 @@ --- -name: Build And Push image - +name: ci on: push: - branches: [ main ] - tags: [ v* ] pull_request: branches: [ main ] jobs: + lint: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: --timeout 5m + test: + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: run tests using make + run: make test docker: name: docker runs-on: ubuntu-latest @@ -16,15 +30,15 @@ jobs: - lint - test steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 + - uses: actions/checkout@v4 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/metadata-action@v3 + - uses: docker/metadata-action@v5 id: meta with: images: ghcr.io/${{ github.repository }} @@ -33,11 +47,13 @@ jobs: type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - - uses: docker/build-push-action@v2 + type=semver,pattern={{major}} + type=sha + - uses: docker/build-push-action@v5 with: file: "Dockerfile" context: . platforms: linux/amd64 - push: true + push: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/lint_and_test.yaml b/.github/workflows/lint_and_test.yaml deleted file mode 100644 index e956868..0000000 --- a/.github/workflows/lint_and_test.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: ci -on: - push: - pull_request: - branches: [ main ] - -jobs: - lint: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - version: latest - args: --timeout 5m - test: - name: test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: run tests using make - run: make test diff --git a/controllers/agesecret_controller_test.go b/controllers/agesecret_controller_test.go index 9810f91..617c816 100644 --- a/controllers/agesecret_controller_test.go +++ b/controllers/agesecret_controller_test.go @@ -85,6 +85,11 @@ var _ = Describe("", func() { Expect(string(testKeyValue)).Should(Equal("test_value")) Expect(exists).To(BeTrue()) + // Remove secret, it should be created again + err = k8sClient.Delete(ctx, fooSecretObj) + err = k8sClient.Get(ctx, types.NamespacedName{Namespace: validAgeSecretObj.Namespace, Name: validAgeSecretObj.Name}, fooSecretObj) + Expect(err).To(BeNil()) + err = k8sClient.Delete(ctx, validAgeKeyObj) Expect(err).To(BeNil())