Skip to content

Commit 683756b

Browse files
authored
chore: parameterize persist artifacts (#32972)
* use pipeline param in pull requests to override artifact persistence * fix jq err when triggering pipeline * simplify parameter usage * Update config.yml * do not run pull request workflow when persisting artifacts
1 parent 406ece7 commit 683756b

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

.circleci/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ parameters:
1616
publish-binary-branch:
1717
type: string
1818
default: main
19+
force-persist-artifacts:
20+
type: boolean
21+
default: false
1922

2023
commands:
2124
persist:

.circleci/src/pipeline/@pipeline.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ parameters:
1818
publish-binary-branch:
1919
type: string
2020
default: main
21+
force-persist-artifacts:
22+
type: boolean
23+
default: false
2124

2225
orbs:
2326
browser-tools: circleci/[email protected]
@@ -121,9 +124,13 @@ commands:
121124
name: Set environment variable to determine whether or not to persist artifacts
122125
command: |
123126
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
124-
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "feat/add_zoneless_angular_harness" ]]; then
125-
export SHOULD_PERSIST_ARTIFACTS=true
126-
fi' >> "$BASH_ENV"
127+
if [[ "<< pipeline.parameters.force-persist-artifacts >>" == "true" ]]; then
128+
echo 'export SHOULD_PERSIST_ARTIFACTS=true' >> "$BASH_ENV"
129+
else
130+
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* ]]; then
131+
export SHOULD_PERSIST_ARTIFACTS=true
132+
fi' >> "$BASH_ENV"
133+
fi
127134
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
128135
verify_should_persist_artifacts:
129136
steps:

.circleci/src/pipeline/workflows/@main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ linux-x64:
44
- equal: [ develop, << pipeline.git.branch >> ]
55
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
66
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
7-
- equal: [ 'remove-unused-dev-deps', << pipeline.git.branch >> ]
87
- matches:
98
pattern: /^release\/\d+\.\d+\.\d+$/
109
value: << pipeline.git.branch >>
10+
- equal: [ true, << pipeline.parameters.force-persist-artifacts >> ]
1111
jobs:
1212
- node_modules_install:
1313
build-better-sqlite3: true

.circleci/src/pipeline/workflows/pull-request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ when:
1111
matches:
1212
pattern: /^develop/
1313
value: << pipeline.git.branch >>
14+
- not:
15+
equal: [ true, << pipeline.parameters.force-persist-artifacts >> ]
1416

1517
jobs:
1618
- node_modules_install:

0 commit comments

Comments
 (0)