Skip to content

Commit de44a5b

Browse files
authored
Merge pull request #22 from datavisyn/new_deplyoment_timeout
added timeout to build product
2 parents ef15895 + a4cab9f commit de44a5b

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

.github/workflows/build-product.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: build-product
22

33
on:
44
workflow_call:
5+
inputs:
6+
timeout:
7+
description: "Timeout in minutes for each job"
8+
type: string
9+
default: 30
510
secrets:
611
DATAVISYN_BOT_REPO_TOKEN:
712
required: false
@@ -58,6 +63,7 @@ jobs:
5863
create_workspace: ${{ steps.get-parameters.outputs.create_workspace }}
5964
stage: ${{ steps.get-parameters.outputs.stage }}
6065
runs-on: ubuntu-20.04
66+
timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }}
6167
steps:
6268
# checkout specific repository
6369
- uses: actions/checkout@v3
@@ -100,6 +106,7 @@ jobs:
100106
image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }}
101107
build_time: ${{ needs.prepare-build.outputs.build_time }}
102108
stage: ${{ needs.prepare-build.outputs.stage }}
109+
timeout: ${{ inputs.timeout }}
103110
secrets: inherit
104111
build-workspace:
105112
needs: prepare-build
@@ -115,9 +122,11 @@ jobs:
115122
image_tag2: ${{ needs.prepare-build.outputs.image_tag2 }}
116123
build_time: ${{ needs.prepare-build.outputs.build_time }}
117124
stage: ${{ needs.prepare-build.outputs.stage }}
125+
timeout: ${{ inputs.timeout }}
118126
secrets: inherit
119127
post-build:
120128
needs: [prepare-build, build-single, build-workspace]
129+
timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }}
121130
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')}}
122131
runs-on: ubuntu-20.04
123132
steps:
@@ -139,6 +148,7 @@ jobs:
139148
# Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions
140149
if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }}
141150
runs-on: ubuntu-20.04
151+
timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }}
142152
strategy:
143153
matrix:
144154
customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }}

.github/workflows/build-single-product-part.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ on:
4444
description: "stage for the image (develop or production) depending on the branch name"
4545
required: true
4646
type: string
47+
timeout:
48+
description: "Timeout in minutes for each job"
49+
type: string
50+
default: 30
4751
env:
4852
TIME_ZONE: "Europe/Vienna"
4953
NODE_VERSION: "16.16"
@@ -60,6 +64,7 @@ permissions:
6064
jobs:
6165
build-components:
6266
runs-on: ubuntu-20.04
67+
timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }}
6368
steps:
6469
# checkout specific repository
6570
- uses: actions/checkout@v3

.github/workflows/build-workspace-product-part.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ on:
4444
description: "stage for the image (develop or production) depending on the branch name"
4545
required: true
4646
type: string
47+
timeout:
48+
description: "Timeout in minutes for each job"
49+
type: string
50+
default: 30
4751
env:
4852
VISYN_SCRIPTS_VERSION: "develop"
4953
TIME_ZONE: "Europe/Vienna"
@@ -61,6 +65,7 @@ permissions:
6165
jobs:
6266
build-components:
6367
runs-on: ubuntu-20.04
68+
timeout-minutes: ${{ fromJSON(github.event.inputs.timeout) }}
6469
steps:
6570
# checkout specific repository
6671
- uses: actions/checkout@v3
@@ -191,20 +196,20 @@ jobs:
191196
product_version=$(jq -rc '.version' ./package.json)
192197
echo "product_version=$product_version"
193198
194-
if [[ $product_version == *"SNAPSHOT"* ]]; then
199+
if [[ "$product_version" == *"SNAPSHOT"* ]]; then
195200
echo "replace SNAPSHOT in version with timestamp"
196-
product_version=$(echo "$product_version" | sed "s/SNAPSHOT/$(date +%Y%m%d-%H%M%S)/g")
201+
product_version=${product_version/SNAPSHOT/$(date +%Y%m%d-%H%M%S)}
197202
echo "product_version=$product_version"
198203
fi
199204
200-
workspace_version=$(jq -rc '.version' ./tmp/$COMPONENT/package.json)
205+
workspace_version=$(jq -rc '.version' ./tmp/"$COMPONENT"/package.json)
201206
echo "workspace_version=$workspace_version"
202207
203-
if [[ $product_version != $workspace_version ]]; then
208+
if [[ "$product_version" != "$workspace_version" ]]; then
204209
echo "update workspace version"
205-
jq --arg version "$product_version" '.version = $version' ./tmp/$COMPONENT/package.json > ./tmp/$COMPONENT/package.json.tmp
206-
mv ./tmp/$COMPONENT/package.json.tmp ./tmp/$COMPONENT/package.json
207-
echo "workspace version updated to $(jq -rc '.version' ./tmp/$COMPONENT/package.json)"
210+
jq --arg version "$product_version" '.version = $version' ./tmp/"$COMPONENT"/package.json > ./tmp/"$COMPONENT"/package.json.tmp
211+
mv ./tmp/"$COMPONENT"/package.json.tmp ./tmp/"$COMPONENT"/package.json
212+
echo "workspace version updated to $(jq -rc '.version' ./tmp/"$COMPONENT"/package.json)"
208213
fi
209214
env:
210215
COMPONENT: ${{ inputs.component }}

0 commit comments

Comments
 (0)