diff --git a/.github/workflows/publish-image-with-version.yml b/.github/workflows/publish-image-with-version.yml deleted file mode 100644 index 15cc466..0000000 --- a/.github/workflows/publish-image-with-version.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Create and publish Switchover Agent Docker image with version - -on: - push: - tags: - - "*" - -env: - GITHUB_REGISTRY: ghcr.io - IMAGE_NAME: bcgov/sso-switchover-agent - -jobs: - build-and-push-image: - runs-on: ubuntu-20.04 - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Log in to the GitHub Container registry - uses: docker/login-action@v2 - with: - registry: ${{ env.GITHUB_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,format=long - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - deploy-to-openshift: - needs: [build-and-push-image] - strategy: - matrix: - license: [eb75ad] - env: [dev, test, prod] - runs-on: ubuntu-20.04 - permissions: - contents: read - - steps: - - uses: actions/checkout@v2 - - - name: Authenticate and set context - if: matrix.license == 'eb75ad' - uses: redhat-actions/oc-login@v1 - with: - openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_GOLDDR }} - openshift_token: ${{ secrets.OPENSHIFT_TOKEN_GOLDDR }} - namespace: ${{ matrix.license }}-${{ matrix.env }} - insecure_skip_tls_verify: true - - - name: Deploy app with Helm chart - if: matrix.license == 'eb75ad' - run: | - namespace=${{ matrix.license }}-${{ matrix.env }} - helm dep up - helm upgrade --install --atomic switch-agent . -n ${namespace} \ - -f values.yaml -f "values-${{ matrix.license }}.yaml" --set image.tag="${{ steps.meta.outputs.tags }}" - working-directory: ./helm diff --git a/.github/workflows/publish-image.yml b/.github/workflows/publish-image.yml index 5f9f910..1f266c2 100644 --- a/.github/workflows/publish-image.yml +++ b/.github/workflows/publish-image.yml @@ -75,7 +75,7 @@ jobs: needs: [build-and-push-image] strategy: matrix: - license: [e4ca1d] + license: [e4ca1d, eb75ad] env: [dev, test, prod] runs-on: ubuntu-20.04 permissions: @@ -85,7 +85,7 @@ jobs: - uses: actions/checkout@v2 - name: Authenticate and set context - if: endsWith(github.ref, '/dev') && matrix.license == 'e4ca1d' + if: (endsWith(github.ref, '/dev') && matrix.license == 'e4ca1d' || endsWith(github.ref, '/main') && matrix.license == 'eb75ad') uses: redhat-actions/oc-login@v1 with: openshift_server_url: ${{ secrets.OPENSHIFT_SERVER_GOLDDR }} @@ -94,7 +94,7 @@ jobs: insecure_skip_tls_verify: true - name: Deploy app with Helm chart - if: endsWith(github.ref, '/dev') && matrix.license == 'e4ca1d' + if: (endsWith(github.ref, '/dev') && matrix.license == 'e4ca1d' || endsWith(github.ref, '/main') && matrix.license == 'eb75ad') run: | namespace=${{ matrix.license }}-${{ matrix.env }} helm dep up