diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 08e3754c..c08ac15a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -144,37 +144,37 @@ jobs: SOURCE_IMAGE_TAG: ${{ matrix.SOURCE_IMAGE_TAG }} file: ${{ matrix.SOURCE_CONTEXT_DIR }}/${{ matrix.DOCKER_FILE_PATH }} - # - name: Extract Tags - # id: extract - # if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - # run: echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | grep -oE ':([^[:space:]]+)' | sed '/workflow/d' | sed 's/://g' | tr '\n' ' ')" >> $GITHUB_OUTPUT + - name: Extract Tags + id: extract + if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) + run: echo "tags=$(echo '${{ steps.meta.outputs.tags }}' | grep -oE ':([^[:space:]]+)' | sed '/workflow/d' | sed 's/://g' | tr '\n' ' ')" >> $GITHUB_OUTPUT - # - name: Pull database image - # if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - # run: | - # docker pull ${{ matrix.SOURCE_IMAGE_REGISTRY }}${{ matrix.SOURCE_IMAGE_NAME }}:${{ matrix.SOURCE_IMAGE_TAG }} + - name: Pull database image + if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) + run: | + docker pull ${{ matrix.SOURCE_IMAGE_REGISTRY }}${{ matrix.SOURCE_IMAGE_NAME }}:${{ matrix.SOURCE_IMAGE_TAG }} - # - name: Build database image - # id: build_image - # if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - # uses: redhat-actions/s2i-build@v2 - # with: - # path_context: ${{ matrix.PATH }} - # # Builder image for a java projectE_IMAG - # builder_image: ${{ matrix.SOURCE_IMAGE_REGISTRY }}${{ matrix.SOURCE_IMAGE_NAME }}:${{ matrix.SOURCE_IMAGE_TAG }} - # image: ${{ env.GITHUB_IMAGE_REPO }}${{ matrix.service }} - # tags: ${{ steps.extract.outputs.tags }} + - name: Build database image + id: build_image + if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) + uses: redhat-actions/s2i-build@v2 + with: + path_context: ${{ matrix.PATH }} + # Builder image for a java projectE_IMAG + builder_image: ${{ matrix.SOURCE_IMAGE_REGISTRY }}${{ matrix.SOURCE_IMAGE_NAME }}:${{ matrix.SOURCE_IMAGE_TAG }} + image: ${{ matrix.service }} + tags: ${{ steps.extract.outputs.tags }} - # - name: Push database image - # id: push - # if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - # uses: redhat-actions/push-to-registry@v2 - # with: - # tags: ${{ steps.build_image.outputs.tags }} - # image: ${{ steps.build_image.outputs.image }} - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - # registry: ${{ env.GITHUB_IMAGE_REPO }} + - name: Push database image + id: push + if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) + uses: redhat-actions/push-to-registry@v2 + with: + tags: ${{ steps.build_image.outputs.tags }} + image: ${{ steps.build_image.outputs.image }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ env.GITHUB_IMAGE_REPO }} - name: Log in to the GHCR uses: docker/login-action@v3 @@ -194,14 +194,14 @@ jobs: tags: ${{ steps.meta.outputs.tags }} outputs: type=image,name=target - # - name: Display ${{ matrix.service }} image results - # id: digests - # if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) - # run: | - # echo "registry_path=${{ steps.push.outputs.registry-paths }}" - # digest=${{ steps.push.outputs.digest }} - # echo "digest=${digest}" - # echo "${{ matrix.service }}_digest=${digest}" >> $GITHUB_OUTPUT + - name: Display ${{ matrix.service }} image results + id: digests + if: contains(fromJSON('["aries-endorser-db"]'), matrix.service) + run: | + echo "registry_path=${{ steps.push.outputs.registry-paths }}" + digest=${{ steps.push.outputs.digest }} + echo "digest=${digest}" + echo "${{ matrix.service }}_digest=${digest}" >> $GITHUB_OUTPUT - name: Display ${{ matrix.service}} image results id: digest @@ -213,41 +213,41 @@ jobs: echo "${{ matrix.service }}_digest=${digest}" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT - deploy2dev: - needs: build - env: - ENVIRONMENT: dev - permissions: - packages: write - runs-on: ubuntu-latest - environment: dev - strategy: - # Serialize the deployments - max-parallel: 1 - matrix: - include: - # - service: aries-endorser-db - - service: aries-endorser-agent - - service: aries-endorser-backup - - service: aries-endorser-proxy - - service: aries-endorser-api + # deploy2dev: + # needs: build + # env: + # ENVIRONMENT: dev + # permissions: + # packages: write + # runs-on: ubuntu-latest + # environment: dev + # strategy: + # # Serialize the deployments + # max-parallel: 1 + # matrix: + # include: + # # - service: aries-endorser-db + # - service: aries-endorser-agent + # - service: aries-endorser-backup + # - service: aries-endorser-proxy + # - service: aries-endorser-api - steps: - - name: Checkout - uses: actions/checkout@v4 + # steps: + # - name: Checkout + # uses: actions/checkout@v4 - - name: Deploy to ${{ env.ENVIRONMENT }} - uses: ./.github/workflows/actions/deploy - with: - environment: ${{ env.ENVIRONMENT }} - ghcr_token: ${{ secrets.GITHUB_TOKEN }} - github_image_name: ${{ env.GITHUB_IMAGE_REPO }}${{ matrix.service }} - image_digest: ${{ needs.build.outputs[format ('{0}_digest', matrix.service)] }} - openshift_image_name: ${{ env.OPENSHIFT_IMAGE_REPO }}${{ matrix.service }} - openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }} - namespace: ${{ vars.NAMESPACE }} - deployment_configuration: ${{ matrix.service }} - openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} + # - name: Deploy to ${{ env.ENVIRONMENT }} + # uses: ./.github/workflows/actions/deploy + # with: + # environment: ${{ env.ENVIRONMENT }} + # ghcr_token: ${{ secrets.GITHUB_TOKEN }} + # github_image_name: ${{ env.GITHUB_IMAGE_REPO }}${{ matrix.service }} + # image_digest: ${{ needs.build.outputs[format ('{0}_digest', matrix.service)] }} + # openshift_image_name: ${{ env.OPENSHIFT_IMAGE_REPO }}${{ matrix.service }} + # openshift_server_url: ${{ vars.OPENSHIFT_SERVER_URL }} + # namespace: ${{ vars.NAMESPACE }} + # deployment_configuration: ${{ matrix.service }} + # openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} # rocketchat_webhook: ${{ secrets.ROCKETCHAT_WEBHOOK }} # # deploy2test: