terraspace_ci_circleci 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31ccc3812202bf94460a70d65ef3c01b94056a577b56bd333856ba52975160b8
|
4
|
+
data.tar.gz: 9465d2b5d5673076578cf5bc02aa934638450911894558686d074ecf42165c10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 697e26dbafd89e87eeab8a3c24c0a094d0eaa2a4d32aa48567297a86cbbdf76a6aff45fae0a5c65b1c04d2b389e1240b9f7e0b351648fcd4b067fc347eac3f6c
|
7
|
+
data.tar.gz: 32999d6109cc1ce0feb9abf275b2ff478676a48a5fb0c4780a562cca972e06931a0d07fa84456b98b6b5b9c80c17464ba03ca4d243a3f64590dc05fb042516c7
|
data/CHANGELOG.md
CHANGED
@@ -9,37 +9,59 @@ parameters:
|
|
9
9
|
default: false
|
10
10
|
|
11
11
|
jobs:
|
12
|
-
|
13
|
-
prod_plan:
|
12
|
+
dev_plan:
|
14
13
|
docker:
|
15
14
|
- image: cimg/ruby:3.1.0
|
16
15
|
environment: *common_env_vars
|
17
16
|
steps:
|
18
17
|
- checkout
|
19
18
|
- run: .circleci/bin/install
|
20
|
-
- run:
|
21
|
-
|
19
|
+
- run: terraspace plan demo
|
20
|
+
dev_up:
|
22
21
|
docker:
|
23
22
|
- image: cimg/ruby:3.1.0
|
24
23
|
environment: *common_env_vars
|
25
24
|
steps:
|
26
25
|
- checkout
|
27
26
|
- run: .circleci/bin/install
|
28
|
-
- run:
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
27
|
+
- run: terraspace up demo -y
|
28
|
+
# Manually triggered: TS_ENV=prod
|
29
|
+
prod_plan:
|
30
|
+
docker:
|
31
|
+
- image: cimg/ruby:3.1.0
|
32
|
+
environment: *common_env_vars
|
33
|
+
steps:
|
34
|
+
- checkout
|
35
|
+
- run: .circleci/bin/install
|
36
|
+
- run: TS_ENV=prod terraspace plan demo
|
37
|
+
prod_up:
|
33
38
|
docker:
|
34
39
|
- image: cimg/ruby:3.1.0
|
35
40
|
environment: *common_env_vars
|
36
41
|
steps:
|
37
42
|
- checkout
|
38
43
|
- run: .circleci/bin/install
|
39
|
-
- run:
|
44
|
+
- run: TS_ENV=prod terraspace up demo -y
|
40
45
|
|
41
46
|
workflows:
|
42
|
-
|
47
|
+
# use different dev_plan and dev_up workflows so it shows up on the CircleCI dashboard
|
48
|
+
dev_plan:
|
49
|
+
when:
|
50
|
+
not: << pipeline.parameters.manual >>
|
51
|
+
jobs:
|
52
|
+
- dev_plan:
|
53
|
+
filters:
|
54
|
+
branches:
|
55
|
+
ignore: main
|
56
|
+
dev_up:
|
57
|
+
when:
|
58
|
+
not: << pipeline.parameters.manual >>
|
59
|
+
jobs:
|
60
|
+
- dev_up:
|
61
|
+
filters:
|
62
|
+
branches:
|
63
|
+
only: main
|
64
|
+
prod_with_approval:
|
43
65
|
when: << pipeline.parameters.manual >>
|
44
66
|
jobs:
|
45
67
|
- prod_plan
|
@@ -50,8 +72,3 @@ workflows:
|
|
50
72
|
- prod_up:
|
51
73
|
requires:
|
52
74
|
- hold
|
53
|
-
dev_plan_or_up:
|
54
|
-
when:
|
55
|
-
not: << pipeline.parameters.manual >>
|
56
|
-
jobs:
|
57
|
-
- dev_plan_or_up
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terraspace_ci_circleci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
@@ -39,7 +39,6 @@ files:
|
|
39
39
|
- README.md
|
40
40
|
- Rakefile
|
41
41
|
- lib/template/.circleci/bin/install
|
42
|
-
- lib/template/.circleci/bin/terraspace-plan-or-up.sh
|
43
42
|
- lib/template/.circleci/config.yml
|
44
43
|
- lib/terraspace_ci_circleci.rb
|
45
44
|
- lib/terraspace_ci_circleci/autoloader.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/bin/bash
|
2
|
-
set -ex
|
3
|
-
|
4
|
-
# Looks like only able to conditionally decide with CIRCLE_PULL_REQUEST and CIRCLE_BRANCH
|
5
|
-
# at runtime instead of circleci evaluation time for the workflow we're trying to achieve.
|
6
|
-
# So will "cancel" workflows that don't really want to run we can see this with the status visually.
|
7
|
-
#
|
8
|
-
if [ -n "$CIRCLE_PULL_REQUEST" ]; then
|
9
|
-
exec terraspace plan "$@"
|
10
|
-
else
|
11
|
-
if [ "$CIRCLE_BRANCH" == "main" ]; then
|
12
|
-
exec terraspace up "$@" -y
|
13
|
-
else
|
14
|
-
# cancel workflow and set status
|
15
|
-
if [ -n "$CIRCLE_TOKEN" ] ; then
|
16
|
-
# https://circleci.com/docs/api/v2/index.html#operation/cancelWorkflow
|
17
|
-
curl --request POST \
|
18
|
-
--header "Circle-Token: $CIRCLE_TOKEN" \
|
19
|
-
https://circleci.com/api/v2/workflow/$CIRCLE_WORKFLOW_ID/cancel
|
20
|
-
sleep 10 # seems to allow the curl request to cancel consistently
|
21
|
-
fi
|
22
|
-
# For correct Workflow Cancelled Status also. Correct status only if also cancel via the API
|
23
|
-
circleci step halt
|
24
|
-
fi
|
25
|
-
fi
|