|
27 | 27 | TIME_ZONE: "Europe/Vienna" |
28 | 28 | NODE_VERSION: "20.9" |
29 | 29 | PYTHON_VERSION: "3.10" |
30 | | - WORKFLOW_BRANCH: "main" |
| 30 | + WORKFLOW_BRANCH: "deploy-with-argocd" |
31 | 31 | PYTHON_BASE_IMAGE: "python:3.10.8-slim-bullseye" |
32 | 32 | DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main" |
33 | 33 | DATAVISYN_NGINX_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/nginx:main" |
@@ -129,45 +129,44 @@ jobs: |
129 | 129 | echo "Image Tag 2: ${{ needs.prepare-build.outputs.image_tag2 }}" |
130 | 130 | echo "Stage: ${{ needs.prepare-build.outputs.stage }}" |
131 | 131 | echo "Components: ${{ needs.prepare-build.outputs.components }}" |
| 132 | + echo "app: ${{ needs.prepare-build.outputs.app }}" |
132 | 133 |
|
133 | | -
|
134 | | -
|
135 | | - # deploy: |
136 | | - # needs: [prepare-build, post-build] |
137 | | - # # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions |
138 | | - # if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} |
139 | | - # runs-on: ubuntu-22.04 |
140 | | - # strategy: |
141 | | - # matrix: |
142 | | - # customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} |
143 | | - # steps: |
144 | | - # - name: determine stage to be deployed to |
145 | | - # id: get-parameters |
146 | | - # run: | |
147 | | - # # Try to split the customer from the format customer:stage |
148 | | - # customer="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 1)" |
149 | | - # stage="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 2)" |
150 | | - # # If nothing is found, we assume we just got the customer |
151 | | - # if [ -z "$customer" ]; then |
152 | | - # customer="$CUSTOMER_FULL" |
153 | | - # fi |
154 | | - # # And will deploy to develop if no stage is defined |
155 | | - # if [ -z "$stage" ]; then |
156 | | - # echo "customer $CUSTOMER_FULL does not include stage, using develop instead" |
157 | | - # stage="develop" |
158 | | - # fi |
159 | | - # echo "customer=$customer" >> "$GITHUB_OUTPUT" |
160 | | - # echo "stage=$stage" >> "$GITHUB_OUTPUT" |
161 | | - # env: |
162 | | - # CUSTOMER_FULL: ${{ matrix.customer }} |
163 | | - # shell: bash |
164 | | - # - name: trigger deployment |
165 | | - # uses: datavisyn/github-action-trigger-workflow@v1 |
166 | | - # with: |
167 | | - # owner: "datavisyn" |
168 | | - # repo: "infrastructure-k8s" |
169 | | - # github_token: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }} |
170 | | - # workflow_file_name: "deploy-app.yml" |
171 | | - # ref: ${{ env.WORKFLOW_BRANCH }} |
172 | | - # github_user: ${{ secrets.DV_BOT_USER }} |
173 | | - # 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 }}" }' |
| 134 | + deploy: |
| 135 | + needs: [prepare-build, post-build] |
| 136 | + # Add always() as otherwise the job is being skipped: https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions |
| 137 | + if: ${{ always() && needs.post-build.result == 'success' && fromJSON(needs.prepare-build.outputs.trigger_automatic_deployment) }} |
| 138 | + runs-on: ubuntu-22.04 |
| 139 | + strategy: |
| 140 | + matrix: |
| 141 | + customer: ${{ fromJSON(needs.prepare-build.outputs.customers) }} |
| 142 | + steps: |
| 143 | + - name: determine stage to be deployed to |
| 144 | + id: get-parameters |
| 145 | + run: | |
| 146 | + # Try to split the customer from the format customer:stage |
| 147 | + customer="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 1)" |
| 148 | + stage="$(echo "$CUSTOMER_FULL" | cut -d ":" -s -f 2)" |
| 149 | + # If nothing is found, we assume we just got the customer |
| 150 | + if [ -z "$customer" ]; then |
| 151 | + customer="$CUSTOMER_FULL" |
| 152 | + fi |
| 153 | + # And will deploy to develop if no stage is defined |
| 154 | + if [ -z "$stage" ]; then |
| 155 | + echo "customer $CUSTOMER_FULL does not include stage, using develop instead" |
| 156 | + stage="develop" |
| 157 | + fi |
| 158 | + echo "customer=$customer" >> "$GITHUB_OUTPUT" |
| 159 | + echo "stage=$stage" >> "$GITHUB_OUTPUT" |
| 160 | + env: |
| 161 | + CUSTOMER_FULL: ${{ matrix.customer }} |
| 162 | + shell: bash |
| 163 | + - name: trigger deployment |
| 164 | + uses: datavisyn/github-action-trigger-workflow@v1 |
| 165 | + with: |
| 166 | + owner: "datavisyn" |
| 167 | + repo: "infrastructure-k8s" |
| 168 | + github_token: ${{ secrets.DATAVISYN_BOT_REPO_TOKEN }} |
| 169 | + workflow_file_name: "deploy-app.yml" |
| 170 | + ref: ${{ env.WORKFLOW_BRANCH }} |
| 171 | + github_user: ${{ secrets.DV_BOT_USER }} |
| 172 | + 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_tag1 }}" }' |
0 commit comments