From dadce6a10f78c21c5f981b80388b947b3b267938 Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Mon, 25 Sep 2023 13:45:40 +0200 Subject: [PATCH 01/11] added timeout argument to build --- .github/workflows/build-product.yml | 10 ++++++++++ .../workflows/build-single-product-part.yml | 5 +++++ .../build-workspace-product-part.yml | 19 ++++++++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 8dfeba4e..6c7880e4 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -2,6 +2,11 @@ name: build-product on: workflow_call: + inputs: + timeout: + description: "Timeout in minutes for each job" + type: string + default: 30 secrets: DATAVISYN_BOT_REPO_TOKEN: required: false @@ -58,6 +63,7 @@ jobs: create_workspace: ${{ steps.get-parameters.outputs.create_workspace }} stage: ${{ steps.get-parameters.outputs.stage }} runs-on: ubuntu-20.04 + timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} steps: # checkout specific repository - uses: actions/checkout@v3 @@ -100,6 +106,7 @@ jobs: image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }} build_time: ${{ needs.prepare-build.outputs.build_time }} stage: ${{ needs.prepare-build.outputs.stage }} + timeout: ${{ inputs.timeout }} secrets: inherit build-workspace: needs: prepare-build @@ -115,9 +122,11 @@ jobs: image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }} build_time: ${{ needs.prepare-build.outputs.build_time }} stage: ${{ needs.prepare-build.outputs.stage }} + timeout: ${{ inputs.timeout }} secrets: inherit post-build: needs: [prepare-build, build-single, build-workspace] + timeout: ${{ inputs.timeout }} if: ${{ always() && (needs.build-single.result == 'success' || needs.build-single.result == 'skipped') && (needs.build-workspace.result == 'success' || needs.build-workspace.result == 'skipped') && !(needs.build-workspace.result == 'skipped' && needs.build-single.result == 'skipped')}} runs-on: ubuntu-20.04 steps: @@ -139,6 +148,7 @@ jobs: # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} runs-on: ubuntu-20.04 + timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} strategy: matrix: customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} diff --git a/.github/workflows/build-single-product-part.yml b/.github/workflows/build-single-product-part.yml index f329162a..6053d45a 100644 --- a/.github/workflows/build-single-product-part.yml +++ b/.github/workflows/build-single-product-part.yml @@ -44,6 +44,10 @@ on: description: "stage for the image (develop or production) depending on the branch name" required: true type: string + timeout: + description: "Timeout in minutes for each job" + type: string + default: 30 env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" @@ -60,6 +64,7 @@ permissions: jobs: build-components: runs-on: ubuntu-20.04 + timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} steps: # checkout specific repository - uses: actions/checkout@v3 diff --git a/.github/workflows/build-workspace-product-part.yml b/.github/workflows/build-workspace-product-part.yml index bf0540f3..4727359f 100644 --- a/.github/workflows/build-workspace-product-part.yml +++ b/.github/workflows/build-workspace-product-part.yml @@ -44,6 +44,10 @@ on: description: "stage for the image (develop or production) depending on the branch name" required: true type: string + timeout: + description: "Timeout in minutes for each job" + type: string + default: 30 env: VISYN_SCRIPTS_VERSION: "develop" TIME_ZONE: "Europe/Vienna" @@ -61,6 +65,7 @@ permissions: jobs: build-components: runs-on: ubuntu-20.04 + timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} steps: # checkout specific repository - uses: actions/checkout@v3 @@ -191,20 +196,20 @@ jobs: product_version=$(jq -rc '.version' ./package.json) echo "product_version=$product_version" - if [[ $product_version == *"SNAPSHOT"* ]]; then + if [[ "$product_version" == *"SNAPSHOT"* ]]; then echo "replace SNAPSHOT in version with timestamp" - product_version=$(echo "$product_version" | sed "s/SNAPSHOT/$(date +%Y%m%d-%H%M%S)/g") + product_version=${product_version/SNAPSHOT/$(date +%Y%m%d-%H%M%S)} echo "product_version=$product_version" fi - workspace_version=$(jq -rc '.version' ./tmp/$COMPONENT/package.json) + workspace_version=$(jq -rc '.version' ./tmp/"$COMPONENT"/package.json) echo "workspace_version=$workspace_version" - if [[ $product_version != $workspace_version ]]; then + if [[ "$product_version" != "$workspace_version" ]]; then echo "update workspace version" - jq --arg version "$product_version" '.version = $version' ./tmp/$COMPONENT/package.json > ./tmp/$COMPONENT/package.json.tmp - mv ./tmp/$COMPONENT/package.json.tmp ./tmp/$COMPONENT/package.json - echo "workspace version updated to $(jq -rc '.version' ./tmp/$COMPONENT/package.json)" + jq --arg version "$product_version" '.version = $version' ./tmp/"$COMPONENT"/package.json > ./tmp/"$COMPONENT"/package.json.tmp + mv ./tmp/"$COMPONENT"/package.json.tmp ./tmp/"$COMPONENT"/package.json + echo "workspace version updated to $(jq -rc '.version' ./tmp/"$COMPONENT"/package.json)" fi env: COMPONENT: ${{ inputs.component }} From 577e5e242a5e20fb65297a8748b5ef2037a52a5a Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Mon, 25 Sep 2023 13:52:35 +0200 Subject: [PATCH 02/11] added timeout argument to build --- .github/workflows/build-product.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 6c7880e4..be1c4de7 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -126,7 +126,7 @@ jobs: secrets: inherit post-build: needs: [prepare-build, build-single, build-workspace] - timeout: ${{ inputs.timeout }} + timeout-minutes: ${{ inputs.timeout }} if: ${{ always() && (needs.build-single.result == 'success' || needs.build-single.result == 'skipped') && (needs.build-workspace.result == 'success' || needs.build-workspace.result == 'skipped') && !(needs.build-workspace.result == 'skipped' && needs.build-single.result == 'skipped')}} runs-on: ubuntu-20.04 steps: From 3561338836218885bb34a3b801e3df68016edd6e Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Mon, 25 Sep 2023 13:55:07 +0200 Subject: [PATCH 03/11] added timeout argument to build --- .github/workflows/build-product.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index be1c4de7..8b048f15 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -126,7 +126,7 @@ jobs: secrets: inherit post-build: needs: [prepare-build, build-single, build-workspace] - timeout-minutes: ${{ inputs.timeout }} + timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} if: ${{ always() && (needs.build-single.result == 'success' || needs.build-single.result == 'skipped') && (needs.build-workspace.result == 'success' || needs.build-workspace.result == 'skipped') && !(needs.build-workspace.result == 'skipped' && needs.build-single.result == 'skipped')}} runs-on: ubuntu-20.04 steps: From 085fee1e09aa149a9777a758414bc44fb3ce9cd6 Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Mon, 25 Sep 2023 16:57:07 +0200 Subject: [PATCH 04/11] added timeout argument to build --- .github/workflows/build-product.yml | 84 ++++++++++++++--------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 8b048f15..06b3b5f3 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -106,7 +106,7 @@ jobs: image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }} build_time: ${{ needs.prepare-build.outputs.build_time }} stage: ${{ needs.prepare-build.outputs.stage }} - timeout: ${{ inputs.timeout }} + timeout: ${{ github.event.inputs.timeout }} secrets: inherit build-workspace: needs: prepare-build @@ -122,7 +122,7 @@ jobs: image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }} build_time: ${{ needs.prepare-build.outputs.build_time }} stage: ${{ needs.prepare-build.outputs.stage }} - timeout: ${{ inputs.timeout }} + timeout: ${{ github.event.inputs.timeout }} secrets: inherit post-build: needs: [prepare-build, build-single, build-workspace] @@ -143,43 +143,43 @@ jobs: ecr_repositories: ${{ needs.prepare-build.outputs.ecr_repos }} current_image_tag: ${{ needs.prepare-build.outputs.image_tag1 }} additional_image_tag: ${{ needs.prepare-build.outputs.image_tag2 }} - deploy: - needs: [prepare-build, post-build] - # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions - if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} - runs-on: ubuntu-20.04 - timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} - strategy: - matrix: - customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} - steps: - - name: determine stage to be deployed to - id: get-parameters - run: | - # Try to split the customer from the format customer:stage - customer="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 1)" - stage="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 2)" - # If nothing is found, we assume we just got the customer - if [ -z "$customer" ]; then - customer="$CUSTOMER_FULL" - fi - # And will deploy to develop if no stage is defined - if [ -z "$stage" ]; then - echo "customer $CUSTOMER_FULL does not include stage, using develop instead" - stage="develop" - fi - echo "customer=$customer" >> "$GITHUB_OUTPUT" - echo "stage=$stage" >> "$GITHUB_OUTPUT" - env: - CUSTOMER_FULL: ${{ matrix.customer }} - shell: bash - - name: trigger deployment - uses: datavisyn/github-action-trigger-workflow@v1 - with: - owner: "datavisyn" - repo: "infrastructure-k8s" - github_token: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }} - workflow_file_name: "deploy-app.yml" - ref: ${{ env.WORKFLOW_BRANCH }} - github_user: ${{ secrets.DV_BOT_USER }} - client_payload: '{ "app": "${{ needs.prepare-build.outputs.app }}", "customer": "${{ steps.get-parameters.outputs.customer }}", "stage": "${{ steps.get-parameters.outputs.stage }}", "sub_app": "${{ needs.prepare-build.outputs.sub_app }}", "branch": "${{ needs.prepare-build.outputs.image_tag2 }}" }' + # deploy: + # needs: [prepare-build, post-build] + # # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions + # if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} + # runs-on: ubuntu-20.04 + # timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} + # strategy: + # matrix: + # customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} + # steps: + # - name: determine stage to be deployed to + # id: get-parameters + # run: | + # # Try to split the customer from the format customer:stage + # customer="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 1)" + # stage="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 2)" + # # If nothing is found, we assume we just got the customer + # if [ -z "$customer" ]; then + # customer="$CUSTOMER_FULL" + # fi + # # And will deploy to develop if no stage is defined + # if [ -z "$stage" ]; then + # echo "customer $CUSTOMER_FULL does not include stage, using develop instead" + # stage="develop" + # fi + # echo "customer=$customer" >> "$GITHUB_OUTPUT" + # echo "stage=$stage" >> "$GITHUB_OUTPUT" + # env: + # CUSTOMER_FULL: ${{ matrix.customer }} + # shell: bash + # - name: trigger deployment + # uses: datavisyn/github-action-trigger-workflow@v1 + # with: + # owner: "datavisyn" + # repo: "infrastructure-k8s" + # github_token: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }} + # workflow_file_name: "deploy-app.yml" + # ref: ${{ env.WORKFLOW_BRANCH }} + # github_user: ${{ secrets.DV_BOT_USER }} + # client_payload: '{ "app": "${{ needs.prepare-build.outputs.app }}", "customer": "${{ steps.get-parameters.outputs.customer }}", "stage": "${{ steps.get-parameters.outputs.stage }}", "sub_app": "${{ needs.prepare-build.outputs.sub_app }}", "branch": "${{ needs.prepare-build.outputs.image_tag2 }}" }' From d855d7cec92e2a1d534f8b7e00115622cbfdd62c Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Tue, 26 Sep 2023 11:38:21 +0200 Subject: [PATCH 05/11] added timeout inputs for called workflows --- .github/workflows/build-product.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 06b3b5f3..82d5fd34 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -99,7 +99,7 @@ jobs: fail-fast: true matrix: component: ${{fromJson(needs.prepare-build.outputs.components)}} - uses: datavisyn/github-workflows/.github/workflows/build-single-product-part.yml@new_deployment + uses: datavisyn/github-workflows/.github/workflows/build-single-product-part.yml@new_deployment_timeout with: component: ${{ matrix.component }} image_tag1: ${{ needs.prepare-build.outputs.image_tag1 }} @@ -115,7 +115,7 @@ jobs: fail-fast: true matrix: component: ${{fromJson(needs.prepare-build.outputs.components)}} - uses: datavisyn/github-workflows/.github/workflows/build-workspace-product-part.yml@new_deployment + uses: datavisyn/github-workflows/.github/workflows/build-workspace-product-part.yml@new_deployment_timeout with: component: ${{ matrix.component }} image_tag1: ${{ needs.prepare-build.outputs.image_tag1 }} From 6e9d074bfe4e6534609bb8ca49959ee5cac5ac58 Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Tue, 26 Sep 2023 12:20:28 +0200 Subject: [PATCH 06/11] testing timeout --- .github/workflows/build-product.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 82d5fd34..4173b0b8 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -35,7 +35,7 @@ env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" PYTHON_VERSION: "3.10" - WORKFLOW_BRANCH: "new_deployment" + WORKFLOW_BRANCH: "new_deployment_timeout" PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" @@ -63,7 +63,7 @@ jobs: create_workspace: ${{ steps.get-parameters.outputs.create_workspace }} stage: ${{ steps.get-parameters.outputs.stage }} runs-on: ubuntu-20.04 - timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} + timeout-minutes: ${{ fromJSON(inputs.timeout) }} steps: # checkout specific repository - uses: actions/checkout@v3 From 480c0a623e12e1b415402919727e2d3de0ae29ee Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Tue, 26 Sep 2023 12:23:54 +0200 Subject: [PATCH 07/11] testing timeout --- .github/workflows/build-product.yml | 2 +- .github/workflows/build-single-product-part.yml | 2 +- .github/workflows/build-workspace-product-part.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 4173b0b8..040eae82 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -126,7 +126,7 @@ jobs: secrets: inherit post-build: needs: [prepare-build, build-single, build-workspace] - timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} + timeout-minutes: ${{ fromJSON(inputs.timeout) }} if: ${{ always() && (needs.build-single.result == 'success' || needs.build-single.result == 'skipped') && (needs.build-workspace.result == 'success' || needs.build-workspace.result == 'skipped') && !(needs.build-workspace.result == 'skipped' && needs.build-single.result == 'skipped')}} runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/build-single-product-part.yml b/.github/workflows/build-single-product-part.yml index 6053d45a..8d390dec 100644 --- a/.github/workflows/build-single-product-part.yml +++ b/.github/workflows/build-single-product-part.yml @@ -64,7 +64,7 @@ permissions: jobs: build-components: runs-on: ubuntu-20.04 - timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} + timeout-minutes: ${{ fromJSON(inputs.timeout) }} steps: # checkout specific repository - uses: actions/checkout@v3 diff --git a/.github/workflows/build-workspace-product-part.yml b/.github/workflows/build-workspace-product-part.yml index 4727359f..61e054a2 100644 --- a/.github/workflows/build-workspace-product-part.yml +++ b/.github/workflows/build-workspace-product-part.yml @@ -65,7 +65,7 @@ permissions: jobs: build-components: runs-on: ubuntu-20.04 - timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} + timeout-minutes: ${{ fromJSON(inputs.timeout) }} steps: # checkout specific repository - uses: actions/checkout@v3 From 79b9b4776d9b9b48e29f9ca2e5860289990150d5 Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Tue, 26 Sep 2023 12:29:56 +0200 Subject: [PATCH 08/11] testing timeout --- .github/workflows/build-product.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index 040eae82..dbe19b5f 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -106,7 +106,7 @@ jobs: image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }} build_time: ${{ needs.prepare-build.outputs.build_time }} stage: ${{ needs.prepare-build.outputs.stage }} - timeout: ${{ github.event.inputs.timeout }} + timeout: ${{ inputs.timeout }} secrets: inherit build-workspace: needs: prepare-build @@ -122,7 +122,7 @@ jobs: image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }} build_time: ${{ needs.prepare-build.outputs.build_time }} stage: ${{ needs.prepare-build.outputs.stage }} - timeout: ${{ github.event.inputs.timeout }} + timeout: ${{ inputs.timeout }} secrets: inherit post-build: needs: [prepare-build, build-single, build-workspace] From ad8856045fc6b0ff3441d5f8522cf385109323e7 Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Tue, 26 Sep 2023 13:34:47 +0200 Subject: [PATCH 09/11] testing timeout --- .github/workflows/build-single-product-part.yml | 2 +- .github/workflows/build-workspace-product-part.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-single-product-part.yml b/.github/workflows/build-single-product-part.yml index 8d390dec..8f1b6ee9 100644 --- a/.github/workflows/build-single-product-part.yml +++ b/.github/workflows/build-single-product-part.yml @@ -52,7 +52,7 @@ env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" PYTHON_VERSION: "3.10" - WORKFLOW_BRANCH: "new_deployment" + WORKFLOW_BRANCH: "new_deployment_timeout" PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" diff --git a/.github/workflows/build-workspace-product-part.yml b/.github/workflows/build-workspace-product-part.yml index 61e054a2..719660ef 100644 --- a/.github/workflows/build-workspace-product-part.yml +++ b/.github/workflows/build-workspace-product-part.yml @@ -53,7 +53,7 @@ env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" PYTHON_VERSION: "3.10" - WORKFLOW_BRANCH: "new_deployment" + WORKFLOW_BRANCH: "new_deployment_timeout" PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" From eda850ee1d447abfbe8a4c26350ea0dc4c869e05 Mon Sep 17 00:00:00 2001 From: Viktor Delev Date: Tue, 26 Sep 2023 13:50:41 +0200 Subject: [PATCH 10/11] finished timeout --- .github/workflows/build-product.yml | 86 +++++++++---------- .../workflows/build-single-product-part.yml | 2 +- .../build-workspace-product-part.yml | 2 +- 3 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.github/workflows/build-product.yml b/.github/workflows/build-product.yml index dbe19b5f..b69b1583 100644 --- a/.github/workflows/build-product.yml +++ b/.github/workflows/build-product.yml @@ -35,7 +35,7 @@ env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" PYTHON_VERSION: "3.10" - WORKFLOW_BRANCH: "new_deployment_timeout" + WORKFLOW_BRANCH: "new_deployment" PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" @@ -99,7 +99,7 @@ jobs: fail-fast: true matrix: component: ${{fromJson(needs.prepare-build.outputs.components)}} - uses: datavisyn/github-workflows/.github/workflows/build-single-product-part.yml@new_deployment_timeout + uses: datavisyn/github-workflows/.github/workflows/build-single-product-part.yml@new_deployment with: component: ${{ matrix.component }} image_tag1: ${{ needs.prepare-build.outputs.image_tag1 }} @@ -115,7 +115,7 @@ jobs: fail-fast: true matrix: component: ${{fromJson(needs.prepare-build.outputs.components)}} - uses: datavisyn/github-workflows/.github/workflows/build-workspace-product-part.yml@new_deployment_timeout + uses: datavisyn/github-workflows/.github/workflows/build-workspace-product-part.yml@new_deployment with: component: ${{ matrix.component }} image_tag1: ${{ needs.prepare-build.outputs.image_tag1 }} @@ -143,43 +143,43 @@ jobs: ecr_repositories: ${{ needs.prepare-build.outputs.ecr_repos }} current_image_tag: ${{ needs.prepare-build.outputs.image_tag1 }} additional_image_tag: ${{ needs.prepare-build.outputs.image_tag2 }} - # deploy: - # needs: [prepare-build, post-build] - # # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions - # if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} - # runs-on: ubuntu-20.04 - # timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }} - # strategy: - # matrix: - # customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} - # steps: - # - name: determine stage to be deployed to - # id: get-parameters - # run: | - # # Try to split the customer from the format customer:stage - # customer="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 1)" - # stage="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 2)" - # # If nothing is found, we assume we just got the customer - # if [ -z "$customer" ]; then - # customer="$CUSTOMER_FULL" - # fi - # # And will deploy to develop if no stage is defined - # if [ -z "$stage" ]; then - # echo "customer $CUSTOMER_FULL does not include stage, using develop instead" - # stage="develop" - # fi - # echo "customer=$customer" >> "$GITHUB_OUTPUT" - # echo "stage=$stage" >> "$GITHUB_OUTPUT" - # env: - # CUSTOMER_FULL: ${{ matrix.customer }} - # shell: bash - # - name: trigger deployment - # uses: datavisyn/github-action-trigger-workflow@v1 - # with: - # owner: "datavisyn" - # repo: "infrastructure-k8s" - # github_token: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }} - # workflow_file_name: "deploy-app.yml" - # ref: ${{ env.WORKFLOW_BRANCH }} - # github_user: ${{ secrets.DV_BOT_USER }} - # client_payload: '{ "app": "${{ needs.prepare-build.outputs.app }}", "customer": "${{ steps.get-parameters.outputs.customer }}", "stage": "${{ steps.get-parameters.outputs.stage }}", "sub_app": "${{ needs.prepare-build.outputs.sub_app }}", "branch": "${{ needs.prepare-build.outputs.image_tag2 }}" }' + deploy: + needs: [prepare-build, post-build] + # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions + if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} + runs-on: ubuntu-20.04 + timeout-minutes: ${{ fromJSON(inputs.timeout) }} + strategy: + matrix: + customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} + steps: + - name: determine stage to be deployed to + id: get-parameters + run: | + # Try to split the customer from the format customer:stage + customer="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 1)" + stage="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 2)" + # If nothing is found, we assume we just got the customer + if [ -z "$customer" ]; then + customer="$CUSTOMER_FULL" + fi + # And will deploy to develop if no stage is defined + if [ -z "$stage" ]; then + echo "customer $CUSTOMER_FULL does not include stage, using develop instead" + stage="develop" + fi + echo "customer=$customer" >> "$GITHUB_OUTPUT" + echo "stage=$stage" >> "$GITHUB_OUTPUT" + env: + CUSTOMER_FULL: ${{ matrix.customer }} + shell: bash + - name: trigger deployment + uses: datavisyn/github-action-trigger-workflow@v1 + with: + owner: "datavisyn" + repo: "infrastructure-k8s" + github_token: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }} + workflow_file_name: "deploy-app.yml" + ref: ${{ env.WORKFLOW_BRANCH }} + github_user: ${{ secrets.DV_BOT_USER }} + client_payload: '{ "app": "${{ needs.prepare-build.outputs.app }}", "customer": "${{ steps.get-parameters.outputs.customer }}", "stage": "${{ steps.get-parameters.outputs.stage }}", "sub_app": "${{ needs.prepare-build.outputs.sub_app }}", "branch": "${{ needs.prepare-build.outputs.image_tag2 }}" }' diff --git a/.github/workflows/build-single-product-part.yml b/.github/workflows/build-single-product-part.yml index 8f1b6ee9..8d390dec 100644 --- a/.github/workflows/build-single-product-part.yml +++ b/.github/workflows/build-single-product-part.yml @@ -52,7 +52,7 @@ env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" PYTHON_VERSION: "3.10" - WORKFLOW_BRANCH: "new_deployment_timeout" + WORKFLOW_BRANCH: "new_deployment" PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" diff --git a/.github/workflows/build-workspace-product-part.yml b/.github/workflows/build-workspace-product-part.yml index 719660ef..61e054a2 100644 --- a/.github/workflows/build-workspace-product-part.yml +++ b/.github/workflows/build-workspace-product-part.yml @@ -53,7 +53,7 @@ env: TIME_ZONE: "Europe/Vienna" NODE_VERSION: "16.16" PYTHON_VERSION: "3.10" - WORKFLOW_BRANCH: "new_deployment_timeout" + WORKFLOW_BRANCH: "new_deployment" PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" From 53eca43f6f1621b137c713f8e974a6d5447c9a5b Mon Sep 17 00:00:00 2001 From: Viktor <109960607+dvviktordelev@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:16:44 +0200 Subject: [PATCH 11/11] reverted runs_on in build-node-python.yml --- .github/workflows/build-node-python.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-node-python.yml b/.github/workflows/build-node-python.yml index 9125fa3a..a4bd5a17 100644 --- a/.github/workflows/build-node-python.yml +++ b/.github/workflows/build-node-python.yml @@ -28,10 +28,6 @@ on: type: boolean required: false default: false - runs_on: - type: string - required: false - default: "ubuntu-20.04" secrets: DATAVISYN_BOT_REPO_TOKEN: required: false @@ -66,7 +62,7 @@ jobs: permissions: id-token: write contents: write - runs-on: ${{ inputs.runs_on }} + runs-on: ubuntu-20.04 steps: - name: Checkout source repository uses: actions/checkout@v3 @@ -93,7 +89,7 @@ jobs: concurrency: group: "python-${{ github.workflow }}-${{ github.ref || github.head_ref }}-${{ inputs.branch }}" cancel-in-progress: true - runs-on: ${{ inputs.runs_on }} + runs-on: ubuntu-20.04 steps: - name: Checkout source repository uses: actions/checkout@v3 @@ -122,7 +118,7 @@ jobs: permissions: id-token: write contents: write - runs-on: ${{ inputs.runs_on }} + runs-on: ubuntu-20.04 services: postgres: @@ -136,6 +132,8 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + ports: + - 5432:5432 steps: - name: Checkout source repository