Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed timeout for build product #26

Open
wants to merge 11 commits into
base: new_deployment
Choose a base branch
from
12 changes: 5 additions & 7 deletions .github/workflows/build-node-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -122,7 +118,7 @@ jobs:
permissions:
id-token: write
contents: write
runs-on: ${{ inputs.runs_on }}
runs-on: ubuntu-20.04

services:
postgres:
Expand All @@ -136,6 +132,8 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- name: Checkout source repository
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/build-product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(inputs.timeout) }}
steps:
# checkout specific repository
- uses: actions/checkout@v3
Expand Down Expand Up @@ -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
Expand All @@ -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-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:
Expand All @@ -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(inputs.timeout) }}
strategy:
matrix:
customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build-single-product-part.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -60,6 +64,7 @@ permissions:
jobs:
build-components:
runs-on: ubuntu-20.04
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
steps:
# checkout specific repository
- uses: actions/checkout@v3
Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/build-workspace-product-part.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -61,6 +65,7 @@ permissions:
jobs:
build-components:
runs-on: ubuntu-20.04
timeout-minutes: ${{ fromJSON(inputs.timeout) }}
steps:
# checkout specific repository
- uses: actions/checkout@v3
Expand Down Expand Up @@ -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 }}
Expand Down