From d077926031e776a80e521feab1d789d57a269d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borja=20Garc=C3=ADa=20Rodr=C3=ADguez?= Date: Tue, 22 Dec 2020 11:13:29 +0100 Subject: [PATCH] WIP --- .github/workflows/apigws/workflow.yml | 30 ++++++ .github/workflows/basket-api/workflow.yml | 25 +++++ .github/workflows/buildimages.yaml | 94 +++++++++++++++++++ .github/workflows/catalog-api/workflow.yml | 25 +++++ .github/workflows/identity-api/workflow.yml | 25 +++++ .github/workflows/infrastructure/workflow.yml | 27 ++++++ .../mobile-shopping-agg/workflow.yml | 24 +++++ .github/workflows/multiarch.yaml | 25 +++++ .github/workflows/ordering-api/workflow.yml | 27 ++++++ .github/workflows/payment-api/workflow.yml | 25 +++++ .../workflows/web-shopping-agg/workflow.yml | 24 +++++ .github/workflows/webhooks-api/workflow.yml | 25 +++++ .../workflows/webhooks-client/workflow.yml | 25 +++++ .github/workflows/webmvc/workflow.yml | 25 +++++ .github/workflows/webspa/workflow.yml | 27 ++++++ .github/workflows/webstatus/workflow.yml | 25 +++++ 16 files changed, 478 insertions(+) create mode 100644 .github/workflows/apigws/workflow.yml create mode 100644 .github/workflows/basket-api/workflow.yml create mode 100644 .github/workflows/buildimages.yaml create mode 100644 .github/workflows/catalog-api/workflow.yml create mode 100644 .github/workflows/identity-api/workflow.yml create mode 100644 .github/workflows/infrastructure/workflow.yml create mode 100644 .github/workflows/mobile-shopping-agg/workflow.yml create mode 100644 .github/workflows/multiarch.yaml create mode 100644 .github/workflows/ordering-api/workflow.yml create mode 100644 .github/workflows/payment-api/workflow.yml create mode 100644 .github/workflows/web-shopping-agg/workflow.yml create mode 100644 .github/workflows/webhooks-api/workflow.yml create mode 100644 .github/workflows/webhooks-client/workflow.yml create mode 100644 .github/workflows/webmvc/workflow.yml create mode 100644 .github/workflows/webspa/workflow.yml create mode 100644 .github/workflows/webstatus/workflow.yml diff --git a/.github/workflows/apigws/workflow.yml b/.github/workflows/apigws/workflow.yml new file mode 100644 index 000000000..1a75fa280 --- /dev/null +++ b/.github/workflows/apigws/workflow.yml @@ -0,0 +1,30 @@ +on: + push: + branches: + - master + - dev + - feature/github-actions + paths: + - src/ApiGateways/* + - .github/workflows/buildimages.yml + - .github/workflows/multiarch.yml + - .github/workflows/apigws/* + - deploy/k8s/helm/apigwmm/* + - deploy/k8s/helm/apigwms/* + - deploy/k8s/helm/apigwwm/* + - deploy/k8s/helm/apigwws/* + paths-ignore: + - src/ApiGateways/Mobile.Bff.Shopping/aggregator/* + - src/ApiGateways/Web.Bff.Shopping/aggregator/* +jobs: + PublishCharts: + runs-on: ubuntu-16.04 + if: ne('${{ env.Build.Reason }}', 'PullRequest') + steps: + - uses: actions/checkout@v2 + - run: Copy '${{ github.workspace }}/deploy/k8s/helm/' '${{ github.workspace }}/deploy/k8s/helm' + shell: powershell + - uses: actions/upload-artifact@v2 + with: + path: ${{ github.workspace }}/deploy/k8s/helm + name: helm \ No newline at end of file diff --git a/.github/workflows/basket-api/workflow.yml b/.github/workflows/basket-api/workflow.yml new file mode 100644 index 000000000..27e685417 --- /dev/null +++ b/.github/workflows/basket-api/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Services/Basket/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/basket-api/* + - deploy/k8s/helm/basket-api/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/buildimages.yaml b/.github/workflows/buildimages.yaml new file mode 100644 index 000000000..2e58cad21 --- /dev/null +++ b/.github/workflows/buildimages.yaml @@ -0,0 +1,94 @@ +parameters: + services: '' + registryEndpoint: '' + helmfrom: '' + helmto: '' + +jobs: +- job: BuildContainersForPR_Linux + condition: eq('${{ variables['Build.Reason'] }}', 'PullRequest') + pool: + vmImage: 'ubuntu-16.04' + steps: + - bash: docker-compose -f src/docker-compose.yml build ${{ parameters.services }} + displayName: Compose build ${{ parameters.services }} + env: + TAG: ${{ variables['Build.SourceBranchName'] }} +- job: BuildContainersForPR_Windows + condition: False + # condition: eq('${{ variables['Build.Reason'] }}', 'PullRequest') + pool: + vmImage: 'windows-2019' + steps: + - bash: docker-compose f src/docker-compose.yml build ${{ parameters.services }} + displayName: Compose build ${{ parameters.services }} + env: + TAG: ${{ variables['Build.SourceBranchName'] }} + PLATFORM: win + NODE_IMAGE: stefanscherer/node-windows:10 +- job: BuildLinux + condition: ne('${{ variables['Build.Reason'] }}', 'PullRequest') + pool: + vmImage: 'ubuntu-16.04' + steps: + - task: DockerCompose@0 + displayName: Compose build ${{ parameters.services }} + inputs: + dockerComposeCommand: 'build ${{ parameters.services }}' + containerregistrytype: Container Registry + dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} + dockerComposeFile: src/docker-compose.yml + qualifyImageNames: true + projectName: "" + dockerComposeFileArgs: | + TAG=${{ variables['Build.SourceBranchName'] }} + - task: DockerCompose@0 + displayName: Compose push ${{ parameters.images }} + inputs: + dockerComposeCommand: 'push ${{ parameters.services }}' + containerregistrytype: Container Registry + dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} + dockerComposeFile: src/docker-compose.yml + qualifyImageNames: true + projectName: "" + dockerComposeFileArgs: | + TAG=${{ variables['Build.SourceBranchName'] }} + - task: CopyFiles@2 + inputs: + sourceFolder: ${{ parameters.helmfrom }} + targetFolder: ${{ parameters.helmto }} + - task: PublishBuildArtifacts@1 + inputs: + pathtoPublish: ${{ parameters.helmto }} + artifactName: helm +- job: BuildWindows + condition: False + # condition: ne('${{ variables['Build.Reason'] }}', 'PullRequest') + pool: + vmImage: 'windows-2019' + steps: + - task: DockerCompose@0 + displayName: Compose build ${{ parameters.services }} + inputs: + dockerComposeCommand: 'build ${{ parameters.services }}' + containerregistrytype: Container Registry + dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} + dockerComposeFile: src/docker-compose.yml + qualifyImageNames: true + projectName: "" + dockerComposeFileArgs: | + TAG=${{ variables['Build.SourceBranchName'] }} + PLATFORM=win + NODE_IMAGE=stefanscherer/node-windows:10 + - task: DockerCompose@0 + displayName: Compose push ${{ parameters.services }} + inputs: + dockerComposeCommand: 'push ${{ parameters.services }}' + containerregistrytype: Container Registry + dockerRegistryEndpoint: ${{ parameters.registryEndpoint }} + dockerComposeFile: src/docker-compose.yml + qualifyImageNames: true + projectName: "" + dockerComposeFileArgs: | + TAG=${{ variables['Build.SourceBranchName'] }} + PLATFORM=win diff --git a/.github/workflows/catalog-api/workflow.yml b/.github/workflows/catalog-api/workflow.yml new file mode 100644 index 000000000..86e945388 --- /dev/null +++ b/.github/workflows/catalog-api/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Services/Catalog/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/catalog-api/* + - deploy/k8s/helm/catalog-api/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/identity-api/workflow.yml b/.github/workflows/identity-api/workflow.yml new file mode 100644 index 000000000..3c6f692e1 --- /dev/null +++ b/.github/workflows/identity-api/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Services/Identity/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/identity-api/* + - deploy/k8s/helm/identity-api/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/infrastructure/workflow.yml b/.github/workflows/infrastructure/workflow.yml new file mode 100644 index 000000000..50e5a5907 --- /dev/null +++ b/.github/workflows/infrastructure/workflow.yml @@ -0,0 +1,27 @@ +on: + push: + branches: + - master + - dev + paths: + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/infrastructure/* + - deploy/k8s/helm/basket-data/* + - deploy/k8s/helm/keystore-data/* + - deploy/k8s/helm/nosql-data/* + - deploy/k8s/helm/rabbitmq/* + - deploy/k8s/helm/sql-data/* +env: + registryEndpoint: eshop-registry +jobs: + build: + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v2 + - run: Copy '${{ github.workspace }}/deploy/k8s/helm/' '${{ github.workspace }}/deploy/k8s/helm' + shell: powershell + - uses: actions/upload-artifact@v2 + with: + path: ${{ github.workspace }}/deploy/k8s/helm + name: helm \ No newline at end of file diff --git a/.github/workflows/mobile-shopping-agg/workflow.yml b/.github/workflows/mobile-shopping-agg/workflow.yml new file mode 100644 index 000000000..791da1360 --- /dev/null +++ b/.github/workflows/mobile-shopping-agg/workflow.yml @@ -0,0 +1,24 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/ApiGateways/Mobile.Bff.Shopping/aggregator/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/mobile-shopping-agg/* + - deploy/k8s/helm/mobileshoppingagg/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/multiarch.yaml b/.github/workflows/multiarch.yaml new file mode 100644 index 000000000..7f2dd1ee4 --- /dev/null +++ b/.github/workflows/multiarch.yaml @@ -0,0 +1,25 @@ +env: + image: '' + branch: '' + registry: eshop + registryEndpoint: '' +jobs: + manifest: + runs-on: Ubuntu 16.04 + needs: + - BuildLinux + if: and(,ne('${{ env.variables['Build.Reason'] }}', 'PullRequest')) + steps: + - uses: actions/checkout@v2 + - name: Docker Login + run: docker login + - name: Create multiarch manifest + run: | + mkdir -p ~/.docker + sed '$ s/.$//' $DOCKER_CONFIG/config.json > ~/.docker/config.json + echo ',"experimental": "enabled" }' >> ~/.docker/config.json + docker --config ~/.docker manifest create ${{ env.parameters.registry }}/${{ env.parameters.image }}:${{ env.parameters.branch }} ${{ env.parameters.registry }}/${{ env.parameters.image }}:linux-${{ env.parameters.branch }} + docker --config ~/.docker manifest create ${{ env.parameters.registry }}/${{ env.parameters.image }}:latest ${{ env.parameters.registry }}/${{ env.parameters.image }}:linux-latest + docker --config ~/.docker manifest push ${{ env.parameters.registry }}/${{ env.parameters.image }}:${{ env.parameters.branch }} + docker --config ~/.docker manifest push ${{ env.parameters.registry }}/${{ env.parameters.image }}:latest + shell: bash \ No newline at end of file diff --git a/.github/workflows/ordering-api/workflow.yml b/.github/workflows/ordering-api/workflow.yml new file mode 100644 index 000000000..d9bd9061a --- /dev/null +++ b/.github/workflows/ordering-api/workflow.yml @@ -0,0 +1,27 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Services/Ordering/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/ordering-api/* + - deploy/k8s/helm/ordering-api/* + - deploy/k8s/helm/ordering-backgroundtasks/* + - deploy/k8s/helm/ordering-signalrhub/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/payment-api/workflow.yml b/.github/workflows/payment-api/workflow.yml new file mode 100644 index 000000000..3e3b5c780 --- /dev/null +++ b/.github/workflows/payment-api/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Services/Payment/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/payment-api/* + - deploy/k8s/helm/payment-api/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/web-shopping-agg/workflow.yml b/.github/workflows/web-shopping-agg/workflow.yml new file mode 100644 index 000000000..670d67b1c --- /dev/null +++ b/.github/workflows/web-shopping-agg/workflow.yml @@ -0,0 +1,24 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/ApiGateways/Web.Bff.Shopping/aggregator/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/web-shopping-agg/* + - deploy/k8s/helm/webshoppingagg/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/webhooks-api/workflow.yml b/.github/workflows/webhooks-api/workflow.yml new file mode 100644 index 000000000..652dbc9b4 --- /dev/null +++ b/.github/workflows/webhooks-api/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Services/Webhooks/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/webhooks-api/* + - deploy/k8s/helm/webhooks-api/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/webhooks-client/workflow.yml b/.github/workflows/webhooks-client/workflow.yml new file mode 100644 index 000000000..839846a24 --- /dev/null +++ b/.github/workflows/webhooks-client/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Web/WebhookClient/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/webhooks-client/* + - deploy/k8s/helm/webhooks-web/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/webmvc/workflow.yml b/.github/workflows/webmvc/workflow.yml new file mode 100644 index 000000000..545d9ffe9 --- /dev/null +++ b/.github/workflows/webmvc/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Web/WebMVC/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/webmvc/* + - deploy/k8s/helm/webmvc/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file diff --git a/.github/workflows/webspa/workflow.yml b/.github/workflows/webspa/workflow.yml new file mode 100644 index 000000000..aefced84a --- /dev/null +++ b/.github/workflows/webspa/workflow.yml @@ -0,0 +1,27 @@ +variables: + registryEndpoint: eshop-registry +trigger: + branches: + include: + - master + - dev + paths: + include: + - src/BuildingBlocks/* + - src/Web/WebSPA/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/webspa/* + - deploy/k8s/helm/webspa/* +jobs: +- template: ../buildimages.yaml + parameters: + services: webspa + registryEndpoint: $(registryEndpoint) + helmfrom: $(Build.SourcesDirectory)/deploy/k8s/helm + helmto: $(Build.ArtifactStagingDirectory)/deploy/k8s/helm +- template: ../multiarch.yaml + parameters: + image: webspa + branch: $(Build.SourceBranchName) + registryEndpoint: $(registryEndpoint) \ No newline at end of file diff --git a/.github/workflows/webstatus/workflow.yml b/.github/workflows/webstatus/workflow.yml new file mode 100644 index 000000000..3e06bf712 --- /dev/null +++ b/.github/workflows/webstatus/workflow.yml @@ -0,0 +1,25 @@ +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +#Note: Azure DevOps template does not have an equivalent in GitHub Actions yet +on: + push: + branches: + - master + - dev + paths: + - src/BuildingBlocks/* + - src/Web/WebStatus/* + - build/azure-devops/buildimages.yml + - build/azure-devops/multiarch.yml + - build/azure-devops/webstatus/* + - deploy/k8s/helm/webstatus/* +env: + registryEndpoint: eshop-registry +jobs: + job_1_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 + job_2_template: + # 'Note: Azure DevOps template does not have an equivalent in GitHub Actions yet' + steps: + - uses: actions/checkout@v2 \ No newline at end of file