From 0f6f843a677f5062dc38de5f364816980fac4621 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Fri, 4 Aug 2023 14:32:06 -0300 Subject: [PATCH 1/4] cd: add new images to CD --- .github/data/Dockerfile | 5 +++-- .github/data/docker-compose.yml | 2 +- .github/data/php8/Dockerfile | 6 ++++++ .github/data/stg/Dockerfile | 6 ++++++ .github/data/test/Dockerfile | 6 ++++++ .github/workflows/cd.yml | 14 +++++++++----- 6 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .github/data/php8/Dockerfile create mode 100644 .github/data/stg/Dockerfile create mode 100644 .github/data/test/Dockerfile diff --git a/.github/data/Dockerfile b/.github/data/Dockerfile index 73c89f8a..941697ef 100644 --- a/.github/data/Dockerfile +++ b/.github/data/Dockerfile @@ -1,6 +1,7 @@ -FROM bitnami/magento:2.4.3 +FROM bitnami/magento:2.4.6 MAINTAINER Open Source Team WORKDIR /opt/bitnami/magento COPY auth.json /opt/bitnami/magento -RUN composer require pagarme/pagarme-magento2-module +RUN composer require pagarme/pagarme-magento2-module:dev-stg + diff --git a/.github/data/docker-compose.yml b/.github/data/docker-compose.yml index 7684270e..e4470411 100644 --- a/.github/data/docker-compose.yml +++ b/.github/data/docker-compose.yml @@ -1,4 +1,4 @@ -version: '2' +version: '3.4' volumes: mariadb_data: driver: local diff --git a/.github/data/php8/Dockerfile b/.github/data/php8/Dockerfile new file mode 100644 index 00000000..648e1f14 --- /dev/null +++ b/.github/data/php8/Dockerfile @@ -0,0 +1,6 @@ +FROM bitnami/magento:2.4.6 +MAINTAINER Open Source Team + +WORKDIR /opt/bitnami/magento +COPY auth.json /opt/bitnami/magento +RUN composer require pagarme/pagarme-magento2-module:dev-stg \ No newline at end of file diff --git a/.github/data/stg/Dockerfile b/.github/data/stg/Dockerfile new file mode 100644 index 00000000..29337b5d --- /dev/null +++ b/.github/data/stg/Dockerfile @@ -0,0 +1,6 @@ +FROM bitnami/magento:2.4.3 +MAINTAINER Open Source Team + +WORKDIR /opt/bitnami/magento +COPY auth.json /opt/bitnami/magento +RUN composer require pagarme/pagarme-magento2-module:dev-stg \ No newline at end of file diff --git a/.github/data/test/Dockerfile b/.github/data/test/Dockerfile new file mode 100644 index 00000000..29337b5d --- /dev/null +++ b/.github/data/test/Dockerfile @@ -0,0 +1,6 @@ +FROM bitnami/magento:2.4.3 +MAINTAINER Open Source Team + +WORKDIR /opt/bitnami/magento +COPY auth.json /opt/bitnami/magento +RUN composer require pagarme/pagarme-magento2-module:dev-stg \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 31a80f23..e12d2e26 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,14 +6,18 @@ on: - develop - test - stg - - master concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - + jobs: - + publish: + - + strategy: + matrix: + tags: [php8, stg, test] + - name: Publish runs-on: ubuntu-latest steps: @@ -25,7 +29,7 @@ jobs: run: | cp .github/data/auth.json . cp .github/data/docker-compose.yml . - cp .github/data/Dockerfile . + cp .github/data/${{ matrix.tags }}/Dockerfile . cp .github/data/wait-for-mysql.sh . cp .github/data/magento2_module_install.sql . - @@ -55,7 +59,7 @@ jobs: with: context: . push: true - tags: ${{ steps.meta.outputs.tags }} + tags: mpdockerregistry.azurecr.io/magento2-pagarme:${{ matrix.tags }} labels: ${{ steps.meta.outputs.labels }} # name: Commit and push Docker image # run: | From f7c95b0950d44ff357a233dbbf3a48c162b12fab Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:53:54 -0300 Subject: [PATCH 2/4] cd: update run mode --- .github/data/test/Dockerfile | 2 +- .github/workflows/cd.yml | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/data/test/Dockerfile b/.github/data/test/Dockerfile index 29337b5d..0d26b853 100644 --- a/.github/data/test/Dockerfile +++ b/.github/data/test/Dockerfile @@ -3,4 +3,4 @@ MAINTAINER Open Source Team WORKDIR /opt/bitnami/magento COPY auth.json /opt/bitnami/magento -RUN composer require pagarme/pagarme-magento2-module:dev-stg \ No newline at end of file +RUN composer require pagarme/pagarme-magento2-module:dev-test \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e12d2e26..aed865bb 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,23 +1,18 @@ name: CD on: - push: - branches: - - develop - - test - - stg + pull_request: + branches: ["stg", "develop"] + types: closed concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - publish: - - strategy: matrix: - tags: [php8, stg, test] - - + tags: [php8, stg] name: Publish runs-on: ubuntu-latest steps: From 8722284725df03a3c29cae07a504cbcfc4cf7fb5 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Fri, 11 Aug 2023 12:04:45 -0300 Subject: [PATCH 3/4] cd: add reusable cd and new images --- .github/data/master/Dockerfile | 6 +++ .github/data/php8/Dockerfile | 2 +- .github/workflows/cd_master.yml | 17 +++++++++ .github/workflows/{cd.yml => cd_reusable.yml} | 37 +++++++++---------- .github/workflows/cd_stg.yml | 17 +++++++++ .github/workflows/cd_test.yml | 17 +++++++++ 6 files changed, 76 insertions(+), 20 deletions(-) create mode 100644 .github/data/master/Dockerfile create mode 100644 .github/workflows/cd_master.yml rename .github/workflows/{cd.yml => cd_reusable.yml} (61%) create mode 100644 .github/workflows/cd_stg.yml create mode 100644 .github/workflows/cd_test.yml diff --git a/.github/data/master/Dockerfile b/.github/data/master/Dockerfile new file mode 100644 index 00000000..37b9bb56 --- /dev/null +++ b/.github/data/master/Dockerfile @@ -0,0 +1,6 @@ +FROM bitnami/magento:2.4.5 +MAINTAINER Open Source Team + +WORKDIR /opt/bitnami/magento +COPY auth.json /opt/bitnami/magento +RUN composer require pagarme/pagarme-magento2-module:master \ No newline at end of file diff --git a/.github/data/php8/Dockerfile b/.github/data/php8/Dockerfile index 648e1f14..c6c01979 100644 --- a/.github/data/php8/Dockerfile +++ b/.github/data/php8/Dockerfile @@ -1,4 +1,4 @@ -FROM bitnami/magento:2.4.6 +FROM bitnami/magento:2.4.5 MAINTAINER Open Source Team WORKDIR /opt/bitnami/magento diff --git a/.github/workflows/cd_master.yml b/.github/workflows/cd_master.yml new file mode 100644 index 00000000..b2a7ccef --- /dev/null +++ b/.github/workflows/cd_master.yml @@ -0,0 +1,17 @@ +name: CD Master + +on: + pull_request: + branches: ["master"] + types: closed +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + call-workflow-cd: + uses: pagarme/magento2/.github/workflows/cd_reusable.yml@master + with: + matrix_tags: "['master']" + secrets: + inherit \ No newline at end of file diff --git a/.github/workflows/cd.yml b/.github/workflows/cd_reusable.yml similarity index 61% rename from .github/workflows/cd.yml rename to .github/workflows/cd_reusable.yml index aed865bb..528cf735 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd_reusable.yml @@ -1,18 +1,17 @@ -name: CD +name: CD REUSABLE on: - pull_request: - branches: ["stg", "develop"] - types: closed -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - + workflow_call: + inputs: + matrix_tags: + required: true + type: string + jobs: publish: strategy: matrix: - tags: [php8, stg] + tags: ${{ fromJson( inputs.matrix_tags ) }} name: Publish runs-on: ubuntu-latest steps: @@ -56,13 +55,13 @@ jobs: push: true tags: mpdockerregistry.azurecr.io/magento2-pagarme:${{ matrix.tags }} labels: ${{ steps.meta.outputs.labels }} - # name: Commit and push Docker image - # run: | - # sleep 5 && docker stop magento2_bitnami - # docker login ${{ secrets.DOCKER_ACCOUNT }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} - # docker commit magento2_bitnami "magento2-pagarme:${{ github.ref_name }}" - # docker push "magento2-pagarme:${{ github.ref_name }}" - # name: Send deployment webhook to Rancher - # run: | - # BODY='{"push_data":{"tag":"'"${{ github.ref }}"'"},"repository":{"repo_name":"'"${{ secrets.DOCKER_ACCOUNT }}/${{ github.repository }}"'"}}' - # curl -X POST ${{ secrets.RANCHER_STG_DEPLOY_URL }} -H 'Content-Type: application/json' -d "${BODY}" + # name: Commit and push Docker image + # run: | + # sleep 5 && docker stop magento2_bitnami + # docker login ${{ secrets.DOCKER_ACCOUNT }} -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + # docker commit magento2_bitnami "magento2-pagarme:${{ github.ref_name }}" + # docker push "magento2-pagarme:${{ github.ref_name }}" + # name: Send deployment webhook to Rancher + # run: | + # BODY='{"push_data":{"tag":"'"${{ github.ref }}"'"},"repository":{"repo_name":"'"${{ secrets.DOCKER_ACCOUNT }}/${{ github.repository }}"'"}}' + # curl -X POST ${{ secrets.RANCHER_STG_DEPLOY_URL }} -H 'Content-Type: application/json' -d "${BODY}" \ No newline at end of file diff --git a/.github/workflows/cd_stg.yml b/.github/workflows/cd_stg.yml new file mode 100644 index 00000000..b864f301 --- /dev/null +++ b/.github/workflows/cd_stg.yml @@ -0,0 +1,17 @@ +name: CD STG AND PHP8 + +on: + pull_request: + branches: ["stg"] + types: closed +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + call-workflow-cd: + uses: pagarme/magento2/.github/workflows/cd_reusable.yml@master + with: + matrix_tags: "['stg', 'php8']" + secrets: + inherit \ No newline at end of file diff --git a/.github/workflows/cd_test.yml b/.github/workflows/cd_test.yml new file mode 100644 index 00000000..9049874d --- /dev/null +++ b/.github/workflows/cd_test.yml @@ -0,0 +1,17 @@ +name: CD TEST + +on: + pull_request: + branches: ["develop"] + types: closed +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + call-workflow-cd: + uses: pagarme/magento2/.github/workflows/cd_reusable.yml@master + with: + matrix_tags: "['test']" + secrets: + inherit \ No newline at end of file From 83060f0f61d7f39713ac9d4101d5841b5191ad14 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Fri, 11 Aug 2023 12:09:10 -0300 Subject: [PATCH 4/4] cd: remove unused dockerfile --- .github/data/Dockerfile | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .github/data/Dockerfile diff --git a/.github/data/Dockerfile b/.github/data/Dockerfile deleted file mode 100644 index 941697ef..00000000 --- a/.github/data/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM bitnami/magento:2.4.6 -MAINTAINER Open Source Team - -WORKDIR /opt/bitnami/magento -COPY auth.json /opt/bitnami/magento -RUN composer require pagarme/pagarme-magento2-module:dev-stg -