Skip to content

Commit b82629e

Browse files
authored
Merge pull request #21 from badsyntax/update-rollback
Detect UPDATE_ROLLBACK_IN_PROGRESS & simplify pipeline workflows
2 parents 5bd67ea + 47d7bbc commit b82629e

File tree

6 files changed

+47
-60
lines changed

6 files changed

+47
-60
lines changed

.github/workflows/deploy-stack.yml renamed to .github/workflows/test-build-deploy.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Update Stack'
1+
name: 'Build, Test & Deploy'
22

33
concurrency:
44
group: prod_deploy
@@ -14,12 +14,42 @@ on:
1414
- master
1515

1616
jobs:
17+
test:
18+
name: 'Build & Test'
19+
runs-on: ubuntu-20.04
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Set Node.js 16.x
24+
uses: actions/[email protected]
25+
with:
26+
node-version: 16.x
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Run all
32+
run: |
33+
npm run lint
34+
npm run format-check
35+
npm test
36+
npm run build
37+
npm run package
38+
- name: Compare the expected and actual dist/ directories
39+
run: |
40+
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
41+
echo "Detected uncommitted changes after build. See status below:"
42+
git diff
43+
exit 1
44+
fi
1745
deploy:
1846
name: 'Deploy'
47+
needs: test
1948
runs-on: ubuntu-20.04
2049
if: github.actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
2150
steps:
2251
- uses: actions/checkout@v2
52+
2353
- name: Configure AWS Credentials
2454
uses: aws-actions/configure-aws-credentials@v1
2555
with:
@@ -45,8 +75,8 @@ jobs:
4575
template: '.github/pr-comment-template.hbs'
4676
id: cloudformation
4777
token: ${{ secrets.GITHUB_TOKEN }}
48-
issueNumber: ${{ github.event.pull_request.number }}
49-
templateInputs: |
78+
issue-number: ${{ github.event.pull_request.number }}
79+
template-inputs: |
5080
{
5181
"changes": ${{ steps.update-stack.outputs.changes }},
5282
"outputs": ${{ steps.update-stack.outputs.outputs }},

.github/workflows/test.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# AWS CloudFormation GitHub Action
22

3-
[![Build & Test](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/test.yml/badge.svg)](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/test.yml)
4-
[![Update Stack](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/deploy-stack.yml/badge.svg)](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/deploy-stack.yml)
3+
[![Build, Test & Deploy](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/test-build-deploy.yml/badge.svg?branch=master)](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/test-build-deploy.yml)
54
[![CodeQL](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/badsyntax/github-action-aws-cloudformation/actions/workflows/codeql-analysis.yml)
65

76
A GitHub Action to create/update your CloudFormation stack to support Infrastructure as Code.

dist/index.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cloudformation.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ import { delay } from './util.js';
2727
let rollbackDetected = false;
2828

2929
function logStackStatus(status: StackStatus): void {
30-
if (status === StackStatus.ROLLBACK_IN_PROGRESS && !rollbackDetected) {
30+
if (
31+
(status === StackStatus.ROLLBACK_IN_PROGRESS ||
32+
status === StackStatus.UPDATE_ROLLBACK_IN_PROGRESS) &&
33+
!rollbackDetected
34+
) {
3135
rollbackDetected = true;
3236
warning(
33-
`${StackStatus.ROLLBACK_IN_PROGRESS} detected! **Check the CloudFormation events in the AWS Console for more information.** ` +
34-
`${StackStatus.ROLLBACK_IN_PROGRESS} can take a while to complete. ` +
37+
`${status} detected! **Check the CloudFormation events in the AWS Console for more information.** ` +
38+
`${status} can take a while to complete. ` +
3539
`You can manually delete the CloudFormation stack in the AWS Console or just wait until this process completes...`
3640
);
3741
}

0 commit comments

Comments
 (0)