diff --git a/.github/workflows/basket-api-deploy.yml b/.github/workflows/basket-api-deploy.yml index 3d51c6d24..38c16ed2e 100644 --- a/.github/workflows/basket-api-deploy.yml +++ b/.github/workflows/basket-api-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/basket-api.yml b/.github/workflows/basket-api.yml index b886d30b9..d8b19993b 100644 --- a/.github/workflows/basket-api.yml +++ b/.github/workflows/basket-api.yml @@ -22,7 +22,6 @@ on: env: SERVICE: basket-api IMAGE: basket.api - DOTNET_VERSION: 5.0.x jobs: @@ -30,97 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Build and run unit tests - run: | - cd src - dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" - cd Services/Basket/Basket.API - dotnet build --no-restore - cd - - cd Services/Basket/Basket.UnitTests - dotnet build --no-restore - dotnet test --no-build -v=normal - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Build and run unit tests - run: | - cd src - dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" - cd Services/Basket/Basket.API - dotnet build --no-restore - cd - - cd Services/Basket/Basket.UnitTests - dotnet build --no-restore - dotnet test --no-build -v=normal - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 - with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/catalog-api-deploy.yml b/.github/workflows/catalog-api-deploy.yml index 7a5827b66..804469296 100644 --- a/.github/workflows/catalog-api-deploy.yml +++ b/.github/workflows/catalog-api-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/catalog-api.yml b/.github/workflows/catalog-api.yml index 9170e7cc8..204e5ddda 100644 --- a/.github/workflows/catalog-api.yml +++ b/.github/workflows/catalog-api.yml @@ -23,6 +23,8 @@ env: SERVICE: catalog-api IMAGE: catalog.api DOTNET_VERSION: 5.0.x + PROJECT_PATH: Services/Catalog/Catalog.API + TESTS_PATH: Services/Catalog/Catalog.UnitTests jobs: @@ -30,97 +32,27 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-test with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Build and run unit tests - run: | - cd src - dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" - cd Services/Catalog/Catalog.API - dotnet build --no-restore - cd - - cd Services/Catalog/Catalog.UnitTests - dotnet build --no-restore - dotnet test --no-build -v=normal - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + dotnet_version: ${{ env.DOTNET_VERSION }} + project_path: ${{ env.PROJECT_PATH }} + tests_path: ${{ env.TESTS_PATH }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Build and run unit tests - run: | - cd src - dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" - cd Services/Catalog/Catalog.API - dotnet build --no-restore - cd - - cd Services/Catalog/Catalog.UnitTests - dotnet build --no-restore - dotnet test --no-build -v=normal - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 - with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/composite/build-push/action.yml b/.github/workflows/composite/build-push/action.yml new file mode 100644 index 000000000..80be3b857 --- /dev/null +++ b/.github/workflows/composite/build-push/action.yml @@ -0,0 +1,71 @@ +name: "Build and push image" +description: "Builds and pushes an image to a registry" + +inputs: + service: + description: "Service to build" + required: true + registry_host: + description: "Image registry host e.g. myacr.azureacr.io" + required: true + registry_endpoint: + description: "Image registry repo e.g. myacr.azureacr.io/eshop" + required: true + image_name: + description: "Name of image" + required: true + registry_username: + description: "Registry username" + required: true + registry_password: + description: "Registry password" + required: true + +runs: + using: "composite" + steps: + - name: Enable experimental features for the Docker daemon and CLI + shell: bash + run: | + echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json + mkdir -p ~/.docker + echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json + sudo service docker restart + docker version -f '{{.Client.Experimental}}' + docker version -f '{{.Server.Experimental}}' + + - name: Login to Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ inputs.registry_host }} + username: ${{ inputs.registry_username }} + password: ${{ inputs.registry_password }} + + - name: Set branch name as env variable + run: | + currentbranch=$(echo ${GITHUB_REF##*/}) + echo "running on $currentbranch" + echo "BRANCH=$currentbranch" >> $GITHUB_ENV + shell: bash + + - name: Compose build ${{ inputs.service }} + shell: bash + run: sudo -E docker-compose build ${{ inputs.service }} + working-directory: ./src + env: + TAG: ${{ env.BRANCH }} + REGISTRY: ${{ inputs.registry_endpoint }} + + - name: Compose push ${{ inputs.service }} + shell: bash + run: sudo -E docker-compose push ${{ inputs.service }} + working-directory: ./src + env: + TAG: ${{ env.BRANCH }} + REGISTRY: ${{ inputs.registry_endpoint }} + + - name: Create multiarch manifest + shell: bash + run: | + docker --config ~/.docker manifest create ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:${{ env.BRANCH }} ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:linux-${{ env.BRANCH }} + docker --config ~/.docker manifest push ${{ inputs.registry_endpoint }}/${{ inputs.image_name }}:${{ env.BRANCH }} \ No newline at end of file diff --git a/.github/workflows/composite/build-test/action.yml b/.github/workflows/composite/build-test/action.yml new file mode 100644 index 000000000..cbee85d73 --- /dev/null +++ b/.github/workflows/composite/build-test/action.yml @@ -0,0 +1,47 @@ +name: "Build for PRe" +description: "Builds a docker image without pushing" + +inputs: + service: + description: "Service to build" + required: true + registry_endpoint: + description: "Image registry repo e.g. myacr.azureacr.io/eshop" + required: true + dotnet_version: + description: "Version of dotnet to use for testing" + required: true + project_path: + description: "Path to project to test e.g. Services/Catalog/Catalog.API" + required: true + tests_path: + description: "Path to test project e.g. Services/Catalog/Catalog.UnitTests" + required: true + +runs: + using: "composite" + steps: + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ inputs.dotnet_version }} + + - name: Build and run unit tests + shell: bash + run: | + cd src + dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" + cd ${{ inputs.project_path }} + dotnet build --no-restore + cd - + cd ${{ inputs.tests_path }} + dotnet build --no-restore + dotnet test --no-build -v=normal + + - name: Compose build ${{ inputs.service }} + shell: bash + run: sudo -E docker-compose build ${{ inputs.service }} + working-directory: ./src + env: + TAG: ${{ env.BRANCH }} + REGISTRY: ${{ inputs.registry_endpoint }} diff --git a/.github/workflows/composite/build/action.yml b/.github/workflows/composite/build/action.yml new file mode 100644 index 000000000..b6f7149c4 --- /dev/null +++ b/.github/workflows/composite/build/action.yml @@ -0,0 +1,21 @@ +name: "Build for PRe" +description: "Builds a docker image without pushing" + +inputs: + service: + description: "Service to build" + required: true + registry_endpoint: + description: "Image registry repo e.g. myacr.azureacr.io/eshop" + required: true + +runs: + using: "composite" + steps: + - name: Compose build ${{ inputs.service }} + shell: bash + run: sudo -E docker-compose build ${{ inputs.service }} + working-directory: ./src + env: + TAG: ${{ env.BRANCH }} + REGISTRY: ${{ inputs.registry_endpoint }} diff --git a/.github/workflows/composite/deploy-helm/action.yml b/.github/workflows/composite/deploy-helm/action.yml new file mode 100644 index 000000000..5bcb4ea16 --- /dev/null +++ b/.github/workflows/composite/deploy-helm/action.yml @@ -0,0 +1,54 @@ +name: "Deploy Helm to AKS" +description: "Deploys a helm chart to AKS" + +inputs: + azure_credentials: + description: "Credentials to connect to AKS" + required: true + cluster_name: + description: "Name of AKS cluster" + required: true + resource_group: + description: "Resource group of AKS cluster" + required: true + registry_host: + description: "Image registry host e.g. myacr.azureacr.io" + required: true + chart: + description: "Chart name" + required: true + chart_root: + description: "Root folder of chart" + required: true + namespace: + description: "Namespace to deploy to" + required: true + +runs: + using: "composite" + steps: + - uses: azure/login@v1 + with: + creds: ${{ inputs.azure_credentials }} + + - uses: azure/aks-set-context@v1 + name: Set AKS context + with: + creds: '${{ inputs.azure_credentials }}' + cluster-name: ${{ inputs.cluster_name }} + resource-group: ${{ inputs.resource_group }} + + - name: Set branch name as env variable + shell: bash + run: | + currentbranch=$(echo ${GITHUB_REF##*/}) + echo "running on $currentbranch" + echo "BRANCH=$currentbranch" >> $GITHUB_ENV + + - name: Deploy Chart + shell: bash + run: | + ./deploy-chart.sh -c ${{ inputs.chart }} --dns aks --aks-name ${{ inputs.clusteR_name }} --aks-rg ${{ inputs.resource_group }} -r ${{ inputs.registry_host }} -t $TAG --namespace ${{ inputs.namespace }} --acr-connected + env: + TAG: ${{ env.BRANCH }} + working-directory: ${{ inputs.chart_root }} \ No newline at end of file diff --git a/.github/workflows/identity-api-deploy.yml b/.github/workflows/identity-api-deploy.yml index 5b2626a3e..c2c0df936 100644 --- a/.github/workflows/identity-api-deploy.yml +++ b/.github/workflows/identity-api-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/identity-api.yml b/.github/workflows/identity-api.yml index b57c8151b..71dc79948 100644 --- a/.github/workflows/identity-api.yml +++ b/.github/workflows/identity-api.yml @@ -1,6 +1,7 @@ name: identity-api on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/mobileshoppingagg-deploy.yml b/.github/workflows/mobileshoppingagg-deploy.yml index 012d4957a..bfe6fa967 100644 --- a/.github/workflows/mobileshoppingagg-deploy.yml +++ b/.github/workflows/mobileshoppingagg-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/mobileshoppingagg.yml b/.github/workflows/mobileshoppingagg.yml index 2de0c0370..f05e5e299 100644 --- a/.github/workflows/mobileshoppingagg.yml +++ b/.github/workflows/mobileshoppingagg.yml @@ -1,6 +1,7 @@ name: mobileshoppingagg on: + workflow_dispatch: push: branches: - dev @@ -26,65 +27,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/ordering-api-deploy.yml b/.github/workflows/ordering-api-deploy.yml index 0ae9d28cb..e689d06a4 100644 --- a/.github/workflows/ordering-api-deploy.yml +++ b/.github/workflows/ordering-api-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/ordering-api.yml b/.github/workflows/ordering-api.yml index 10be98451..6616e75ee 100644 --- a/.github/workflows/ordering-api.yml +++ b/.github/workflows/ordering-api.yml @@ -23,6 +23,8 @@ env: SERVICE: ordering-api IMAGE: ordering.api DOTNET_VERSION: 5.0.x + PROJECT_PATH: Services/Ordering/Ordering.API + TESTS_PATH: Services/Ordering/Ordering.UnitTests jobs: @@ -30,97 +32,27 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-test with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Build and run unit tests - run: | - cd src - dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" - cd Services/Ordering/Ordering.API - dotnet build --no-restore - cd - - cd Services/Ordering/Ordering.UnitTests - dotnet build --no-restore - dotnet test --no-build -v=normal - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + dotnet_version: ${{ env.DOTNET_VERSION }} + project_path: ${{ env.PROJECT_PATH }} + tests_path: ${{ env.TESTS_PATH }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Setup dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: ${{ env.DOTNET_VERSION }} - - - name: Build and run unit tests - run: | - cd src - dotnet restore "eShopOnContainers-ServicesAndWebApps.sln" - cd Services/Ordering/Ordering.API - dotnet build --no-restore - cd - - cd Services/Ordering/Ordering.UnitTests - dotnet build --no-restore - dotnet test --no-build -v=normal - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/ordering-backgroundtasks-deploy.yml b/.github/workflows/ordering-backgroundtasks-deploy.yml index 65eab8148..1b3b7245e 100644 --- a/.github/workflows/ordering-backgroundtasks-deploy.yml +++ b/.github/workflows/ordering-backgroundtasks-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/ordering-backgroundtasks.yml b/.github/workflows/ordering-backgroundtasks.yml index f8f7badfa..0f5a535d8 100644 --- a/.github/workflows/ordering-backgroundtasks.yml +++ b/.github/workflows/ordering-backgroundtasks.yml @@ -1,6 +1,7 @@ name: ordering-backgroundtasks on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/ordering-signalrhub-deploy.yml b/.github/workflows/ordering-signalrhub-deploy.yml index d7842a30f..455cf7f1d 100644 --- a/.github/workflows/ordering-signalrhub-deploy.yml +++ b/.github/workflows/ordering-signalrhub-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/ordering-signalrhub.yml b/.github/workflows/ordering-signalrhub.yml index 564a81458..37d910e53 100644 --- a/.github/workflows/ordering-signalrhub.yml +++ b/.github/workflows/ordering-signalrhub.yml @@ -1,6 +1,7 @@ name: ordering-signalrhub on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/payment-api-deploy.yml b/.github/workflows/payment-api-deploy.yml index 9592259b1..2f37988ed 100644 --- a/.github/workflows/payment-api-deploy.yml +++ b/.github/workflows/payment-api-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/payment-api.yml b/.github/workflows/payment-api.yml index 3cd18756f..66c941152 100644 --- a/.github/workflows/payment-api.yml +++ b/.github/workflows/payment-api.yml @@ -1,6 +1,7 @@ name: payment-api on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/webhooks-api-deploy.yml b/.github/workflows/webhooks-api-deploy.yml index 08955a3d4..4d74a38e6 100644 --- a/.github/workflows/webhooks-api-deploy.yml +++ b/.github/workflows/webhooks-api-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/webhooks-api.yml b/.github/workflows/webhooks-api.yml index f39599d40..bee7b76b3 100644 --- a/.github/workflows/webhooks-api.yml +++ b/.github/workflows/webhooks-api.yml @@ -1,6 +1,7 @@ name: webhooks-api on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/webhooks-client.yml b/.github/workflows/webhooks-client.yml index 6851921fe..1c49a8a5d 100644 --- a/.github/workflows/webhooks-client.yml +++ b/.github/workflows/webhooks-client.yml @@ -1,6 +1,7 @@ name: webhooks-client on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/webmvc-deploy.yml b/.github/workflows/webmvc-deploy.yml index 3f1d9c4a1..e70cefed2 100644 --- a/.github/workflows/webmvc-deploy.yml +++ b/.github/workflows/webmvc-deploy.yml @@ -28,23 +28,12 @@ jobs: with: creds: ${{ secrets.AZURE_CREDENTIALS }} - - uses: azure/aks-set-context@v1 - name: Set AKS context + - uses: ./.github/workflows/composite/deploy-helm with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/webmvc.yml b/.github/workflows/webmvc.yml index 9fc0cdf86..66fcf06bc 100644 --- a/.github/workflows/webmvc.yml +++ b/.github/workflows/webmvc.yml @@ -1,6 +1,7 @@ name: webmvc on: + workflow_dispatch: push: branches: - dev @@ -29,65 +30,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/webshoppingagg-deploy.yml b/.github/workflows/webshoppingagg-deploy.yml index 7cff7ceac..2b4bcaf12 100644 --- a/.github/workflows/webshoppingagg-deploy.yml +++ b/.github/workflows/webshoppingagg-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/webshoppingagg.yml b/.github/workflows/webshoppingagg.yml index 6c6df5dbb..93bc05e09 100644 --- a/.github/workflows/webshoppingagg.yml +++ b/.github/workflows/webshoppingagg.yml @@ -1,6 +1,7 @@ name: webshoppingagg on: + workflow_dispatch: push: branches: - dev @@ -26,65 +27,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/webspa-deploy.yml b/.github/workflows/webspa-deploy.yml index 2700ee9cd..2851f6962 100644 --- a/.github/workflows/webspa-deploy.yml +++ b/.github/workflows/webspa-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/webspa.yml b/.github/workflows/webspa.yml index 3dbc3c496..769a6bdcf 100644 --- a/.github/workflows/webspa.yml +++ b/.github/workflows/webspa.yml @@ -1,6 +1,7 @@ name: webspa on: + workflow_dispatch: push: branches: - dev @@ -28,65 +29,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file diff --git a/.github/workflows/webstatus-deploy.yml b/.github/workflows/webstatus-deploy.yml index dc5629ab9..866a46a5f 100644 --- a/.github/workflows/webstatus-deploy.yml +++ b/.github/workflows/webstatus-deploy.yml @@ -24,27 +24,12 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: azure/login@v1 + - uses: ./.github/workflows/composite/deploy-helm with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - - uses: azure/aks-set-context@v1 - name: Set AKS context - with: - creds: '${{ secrets.AZURE_CREDENTIALS }}' - cluster-name: ${{ secrets.CLUSTER_NAME }} - resource-group: ${{ secrets.RESOURCE_GROUP }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Deploy Chart - run: | - ./deploy-chart.sh -c ${{ env.CHART }} --dns aks --aks-name ${{ secrets.CLUSTER_NAME }} --aks-rg ${{ secrets.RESOURCE_GROUP }} -r ${{ secrets.REGISTRY_HOST }} -t $TAG --namespace ${{ env.NAMESPACE }} --acr-connected - env: - TAG: ${{ env.BRANCH }} - working-directory: ${{ env.CHART_ROOT }} \ No newline at end of file + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + cluster_name: ${{ secrets.CLUSTER_NAME }} + resource_group: ${{ secrets.RESOURCE_GROUP }} + registry_host: ${{ secrets.REGISTRY_HOST }} + chart: ${{ env.CHART }} + chart_root: ${{ env.CHART_ROOT }} + namespace: ${{ env.NAMESPACE }} diff --git a/.github/workflows/webstatus.yml b/.github/workflows/webstatus.yml index 05d941cf2..0cbb89c6a 100644 --- a/.github/workflows/webstatus.yml +++ b/.github/workflows/webstatus.yml @@ -1,6 +1,7 @@ name: webstatus on: + workflow_dispatch: push: branches: - dev @@ -29,65 +30,24 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build + with: + service: ${{ env.SERVICE }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} BuildLinux: runs-on: ubuntu-latest if: ${{ github.event_name != 'pull_request' }} steps: - - name: 'Checkout Github Action' - uses: actions/checkout@master - - - name: Enable experimental features for the Docker daemon and CLI - run: | - echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json - mkdir -p ~/.docker - echo $'{\n "experimental": "enabled"\n}' | sudo tee ~/.docker/config.json - sudo service docker restart - docker version -f '{{.Client.Experimental}}' - docker version -f '{{.Server.Experimental}}' - - - name: Login to Container Registry - uses: docker/login-action@v1 + - name: Checkout code + uses: actions/checkout@v2 + - uses: ./.github/workflows/composite/build-push with: - registry: ${{ secrets.REGISTRY_HOST }} - username: ${{ secrets.USERNAME }} - password: ${{ secrets.PASSWORD }} - - - name: Set branch name as env variable - run: | - currentbranch=$(echo ${GITHUB_REF##*/}) - echo "running on $currentbranch" - echo "BRANCH=$currentbranch" >> $GITHUB_ENV - shell: bash - - - name: Compose build ${{ env.SERVICE }} - run: sudo -E docker-compose build ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Compose push ${{ env.SERVICE }} - run: sudo -E docker-compose push ${{ env.SERVICE }} - working-directory: ./src - shell: bash - env: - TAG: ${{ env.BRANCH }} - REGISTRY: ${{ secrets.REGISTRY_ENDPOINT }} - - - name: Create multiarch manifest - run: | - docker --config ~/.docker manifest create ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:linux-${{ env.BRANCH }} - docker --config ~/.docker manifest push ${{ secrets.REGISTRY_ENDPOINT }}/${{ env.IMAGE }}:${{ env.BRANCH }} - shell: bash \ No newline at end of file + service: ${{ env.SERVICE }} + registry_host: ${{ secrets.REGISTRY_HOST }} + registry_endpoint: ${{ secrets.REGISTRY_ENDPOINT }} + image_name: ${{ env.IMAGE }} + registry_username: ${{ secrets.USERNAME }} + registry_password: ${{ secrets.PASSWORD }} \ No newline at end of file