Skip to content

Commit f82125f

Browse files
Clean up workflow files from Zizmor output (#6409)
1 parent c58f3d5 commit f82125f

14 files changed

+140
-103
lines changed

.github/workflows/_move_edd_db_scripts.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,19 @@ jobs:
4141
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4242
with:
4343
token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
44+
persist-credentials: false
4445

4546
- name: Get script prefix
4647
id: prefix
47-
run: echo "prefix=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
48+
run: echo "prefix=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
4849

4950
- name: Check if any files in DB transition or finalization directories
5051
id: check-script-existence
5152
run: |
5253
if [ -f util/Migrator/DbScripts_transition/* -o -f util/Migrator/DbScripts_finalization/* ]; then
53-
echo "copy_edd_scripts=true" >> $GITHUB_OUTPUT
54+
echo "copy_edd_scripts=true" >> "$GITHUB_OUTPUT"
5455
else
55-
echo "copy_edd_scripts=false" >> $GITHUB_OUTPUT
56+
echo "copy_edd_scripts=false" >> "$GITHUB_OUTPUT"
5657
fi
5758
5859
move-scripts:
@@ -70,17 +71,18 @@ jobs:
7071
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7172
with:
7273
fetch-depth: 0
74+
persist-credentials: true
7375

7476
- name: Generate branch name
7577
id: branch_name
7678
env:
7779
PREFIX: ${{ needs.setup.outputs.migration_filename_prefix }}
78-
run: echo "branch_name=move_edd_db_scripts_$PREFIX" >> $GITHUB_OUTPUT
80+
run: echo "branch_name=move_edd_db_scripts_$PREFIX" >> "$GITHUB_OUTPUT"
7981

8082
- name: "Create branch"
8183
env:
8284
BRANCH: ${{ steps.branch_name.outputs.branch_name }}
83-
run: git switch -c $BRANCH
85+
run: git switch -c "$BRANCH"
8486

8587
- name: Move scripts and finalization database schema
8688
id: move-files
@@ -120,7 +122,7 @@ jobs:
120122
121123
# sync finalization schema back to dbo, maintaining structure
122124
rsync -r "$src_dir/" "$dest_dir/"
123-
rm -rf $src_dir/*
125+
rm -rf "${src_dir}"/*
124126
125127
# Replace any finalization references due to the move
126128
find ./src/Sql/dbo -name "*.sql" -type f -exec sed -i \
@@ -131,7 +133,7 @@ jobs:
131133
moved_files="$moved_files \n $file"
132134
done
133135
134-
echo "moved_files=$moved_files" >> $GITHUB_OUTPUT
136+
echo "moved_files=$moved_files" >> "$GITHUB_OUTPUT"
135137
136138
- name: Log in to Azure
137139
uses: bitwarden/gh-actions/azure-login@main
@@ -162,18 +164,20 @@ jobs:
162164

163165
- name: Commit and push changes
164166
id: commit
167+
env:
168+
BRANCH_NAME: ${{ steps.branch_name.outputs.branch_name }}
165169
run: |
166170
git config --local user.email "[email protected]"
167171
git config --local user.name "bitwarden-devops-bot"
168172
if [ -n "$(git status --porcelain)" ]; then
169173
git add .
170174
git commit -m "Move EDD database scripts" -a
171-
git push -u origin ${{ steps.branch_name.outputs.branch_name }}
172-
echo "pr_needed=true" >> $GITHUB_OUTPUT
175+
git push -u origin "${BRANCH_NAME}"
176+
echo "pr_needed=true" >> "$GITHUB_OUTPUT"
173177
else
174178
echo "No changes to commit!";
175-
echo "pr_needed=false" >> $GITHUB_OUTPUT
176-
echo "### :mega: No changes to commit! PR was ommited." >> $GITHUB_STEP_SUMMARY
179+
echo "pr_needed=false" >> "$GITHUB_OUTPUT"
180+
echo "### :mega: No changes to commit! PR was ommited." >> "$GITHUB_STEP_SUMMARY"
177181
fi
178182
179183
- name: Create PR for ${{ steps.branch_name.outputs.branch_name }}
@@ -195,7 +199,7 @@ jobs:
195199
Files moved:
196200
$(echo -e "$MOVED_FILES")
197201
")
198-
echo "pr_url=${PR_URL}" >> $GITHUB_OUTPUT
202+
echo "pr_url=${PR_URL}" >> "$GITHUB_OUTPUT"
199203
200204
- name: Notify Slack about creation of PR
201205
if: ${{ steps.commit.outputs.pr_needed == 'true' }}

.github/workflows/build.yml

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2929
with:
3030
ref: ${{ github.event.pull_request.head.sha }}
31+
persist-credentials: false
3132

3233
- name: Set up .NET
3334
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
@@ -97,23 +98,24 @@ jobs:
9798
id: check-secrets
9899
run: |
99100
has_secrets=${{ secrets.AZURE_CLIENT_ID != '' }}
100-
echo "has_secrets=$has_secrets" >> $GITHUB_OUTPUT
101+
echo "has_secrets=$has_secrets" >> "$GITHUB_OUTPUT"
101102
102103
- name: Check out repo
103104
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
104105
with:
105106
ref: ${{ github.event.pull_request.head.sha }}
107+
persist-credentials: false
106108

107109
- name: Check branch to publish
108110
env:
109111
PUBLISH_BRANCHES: "main,rc,hotfix-rc"
110112
id: publish-branch-check
111113
run: |
112-
IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES
114+
IFS="," read -a publish_branches <<< "$PUBLISH_BRANCHES"
113115
if [[ " ${publish_branches[*]} " =~ " ${GITHUB_REF:11} " ]]; then
114-
echo "is_publish_branch=true" >> $GITHUB_ENV
116+
echo "is_publish_branch=true" >> "$GITHUB_ENV"
115117
else
116-
echo "is_publish_branch=false" >> $GITHUB_ENV
118+
echo "is_publish_branch=false" >> "$GITHUB_ENV"
117119
fi
118120
119121
- name: Set up .NET
@@ -209,16 +211,16 @@ jobs:
209211
IMAGE_TAG=dev
210212
fi
211213
212-
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
213-
echo "### :mega: Docker Image Tag: $IMAGE_TAG" >> $GITHUB_STEP_SUMMARY
214+
echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
215+
echo "### :mega: Docker Image Tag: $IMAGE_TAG" >> "$GITHUB_STEP_SUMMARY"
214216
215217
- name: Set up project name
216218
id: setup
217219
run: |
218220
PROJECT_NAME=$(echo "${{ matrix.project_name }}" | awk '{print tolower($0)}')
219221
echo "Matrix name: ${{ matrix.project_name }}"
220222
echo "PROJECT_NAME: $PROJECT_NAME"
221-
echo "project_name=$PROJECT_NAME" >> $GITHUB_OUTPUT
223+
echo "project_name=$PROJECT_NAME" >> "$GITHUB_OUTPUT"
222224
223225
- name: Generate image tags(s)
224226
id: image-tags
@@ -228,12 +230,12 @@ jobs:
228230
SHA: ${{ github.sha }}
229231
run: |
230232
TAGS="${_AZ_REGISTRY}/${PROJECT_NAME}:${IMAGE_TAG}"
231-
echo "primary_tag=$TAGS" >> $GITHUB_OUTPUT
233+
echo "primary_tag=$TAGS" >> "$GITHUB_OUTPUT"
232234
if [[ "${IMAGE_TAG}" == "dev" ]]; then
233-
SHORT_SHA=$(git rev-parse --short ${SHA})
235+
SHORT_SHA=$(git rev-parse --short "${SHA}")
234236
TAGS=$TAGS",${_AZ_REGISTRY}/${PROJECT_NAME}:dev-${SHORT_SHA}"
235237
fi
236-
echo "tags=$TAGS" >> $GITHUB_OUTPUT
238+
echo "tags=$TAGS" >> "$GITHUB_OUTPUT"
237239
238240
- name: Build Docker image
239241
id: build-artifacts
@@ -260,12 +262,13 @@ jobs:
260262
DIGEST: ${{ steps.build-artifacts.outputs.digest }}
261263
TAGS: ${{ steps.image-tags.outputs.tags }}
262264
run: |
263-
IFS="," read -a tags <<< "${TAGS}"
264-
images=""
265-
for tag in "${tags[@]}"; do
266-
images+="${tag}@${DIGEST} "
265+
IFS=',' read -r -a tags_array <<< "${TAGS}"
266+
images=()
267+
for tag in "${tags_array[@]}"; do
268+
images+=("${tag}@${DIGEST}")
267269
done
268-
cosign sign --yes ${images}
270+
cosign sign --yes ${images[@]}
271+
echo "images=${images[*]}" >> "$GITHUB_OUTPUT"
269272
270273
- name: Scan Docker image
271274
id: container-scan
@@ -297,6 +300,7 @@ jobs:
297300
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
298301
with:
299302
ref: ${{ github.event.pull_request.head.sha }}
303+
persist-credentials: false
300304

301305
- name: Set up .NET
302306
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0
@@ -309,7 +313,7 @@ jobs:
309313
client_id: ${{ secrets.AZURE_CLIENT_ID }}
310314

311315
- name: Log in to ACR - production subscription
312-
run: az acr login -n $_AZ_REGISTRY --only-show-errors
316+
run: az acr login -n "$_AZ_REGISTRY" --only-show-errors
313317

314318
- name: Make Docker stubs
315319
if: |
@@ -332,26 +336,26 @@ jobs:
332336
STUB_OUTPUT=$(pwd)/docker-stub
333337
334338
# Run setup
335-
docker run -i --rm --name setup -v $STUB_OUTPUT/US:/bitwarden $SETUP_IMAGE \
339+
docker run -i --rm --name setup -v "$STUB_OUTPUT/US:/bitwarden" "$SETUP_IMAGE" \
336340
/app/Setup -stub 1 -install 1 -domain bitwarden.example.com -os lin -cloud-region US
337-
docker run -i --rm --name setup -v $STUB_OUTPUT/EU:/bitwarden $SETUP_IMAGE \
341+
docker run -i --rm --name setup -v "$STUB_OUTPUT/EU:/bitwarden" "$SETUP_IMAGE" \
338342
/app/Setup -stub 1 -install 1 -domain bitwarden.example.com -os lin -cloud-region EU
339343
340-
sudo chown -R $(whoami):$(whoami) $STUB_OUTPUT
344+
sudo chown -R "$(whoami):$(whoami)" "$STUB_OUTPUT"
341345
342346
# Remove extra directories and files
343-
rm -rf $STUB_OUTPUT/US/letsencrypt
344-
rm -rf $STUB_OUTPUT/EU/letsencrypt
345-
rm $STUB_OUTPUT/US/env/uid.env $STUB_OUTPUT/US/config.yml
346-
rm $STUB_OUTPUT/EU/env/uid.env $STUB_OUTPUT/EU/config.yml
347+
rm -rf "$STUB_OUTPUT/US/letsencrypt"
348+
rm -rf "$STUB_OUTPUT/EU/letsencrypt"
349+
rm "$STUB_OUTPUT/US/env/uid.env" "$STUB_OUTPUT/US/config.yml"
350+
rm "$STUB_OUTPUT/EU/env/uid.env" "$STUB_OUTPUT/EU/config.yml"
347351
348352
# Create uid environment files
349-
touch $STUB_OUTPUT/US/env/uid.env
350-
touch $STUB_OUTPUT/EU/env/uid.env
353+
touch "$STUB_OUTPUT/US/env/uid.env"
354+
touch "$STUB_OUTPUT/EU/env/uid.env"
351355
352356
# Zip up the Docker stub files
353-
cd docker-stub/US; zip -r ../../docker-stub-US.zip *; cd ../..
354-
cd docker-stub/EU; zip -r ../../docker-stub-EU.zip *; cd ../..
357+
cd docker-stub/US; zip -r ../../docker-stub-US.zip ./*; cd ../..
358+
cd docker-stub/EU; zip -r ../../docker-stub-EU.zip ./*; cd ../..
355359
356360
- name: Log out from Azure
357361
uses: bitwarden/gh-actions/azure-logout@main
@@ -423,6 +427,7 @@ jobs:
423427
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
424428
with:
425429
ref: ${{ github.event.pull_request.head.sha }}
430+
persist-credentials: false
426431

427432
- name: Set up .NET
428433
uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5.0.0

.github/workflows/cleanup-after-pr.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
client_id: ${{ secrets.AZURE_CLIENT_ID }}
2323

2424
- name: Log in to Azure ACR
25-
run: az acr login -n $_AZ_REGISTRY --only-show-errors
25+
run: az acr login -n "$_AZ_REGISTRY" --only-show-errors
2626

2727
########## Remove Docker images ##########
2828
- name: Remove the Docker image from ACR
@@ -45,20 +45,20 @@ jobs:
4545
- Setup
4646
- Sso
4747
run: |
48-
for SERVICE in $(echo "${{ env.SERVICES }}" | yq e ".services[]" - )
48+
for SERVICE in $(echo "${SERVICES}" | yq e ".services[]" - )
4949
do
50-
SERVICE_NAME=$(echo $SERVICE | awk '{print tolower($0)}')
50+
SERVICE_NAME=$(echo "$SERVICE" | awk '{print tolower($0)}')
5151
IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name
5252
5353
echo "[*] Checking if remote exists: $_AZ_REGISTRY/$SERVICE_NAME:$IMAGE_TAG"
5454
TAG_EXISTS=$(
55-
az acr repository show-tags --name $_AZ_REGISTRY --repository $SERVICE_NAME \
56-
| jq --arg $TAG "$IMAGE_TAG" -e '. | any(. == "$TAG")'
55+
az acr repository show-tags --name "$_AZ_REGISTRY" --repository "$SERVICE_NAME" \
56+
| jq --arg TAG "$IMAGE_TAG" -e '. | any(. == $TAG)'
5757
)
5858
5959
if [[ "$TAG_EXISTS" == "true" ]]; then
6060
echo "[*] Tag exists. Removing tag"
61-
az acr repository delete --name $_AZ_REGISTRY --image $SERVICE_NAME:$IMAGE_TAG --yes
61+
az acr repository delete --name "$_AZ_REGISTRY" --image "$SERVICE_NAME:$IMAGE_TAG" --yes
6262
else
6363
echo "[*] Tag does not exist. No action needed"
6464
fi

.github/workflows/cleanup-rc-branch.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
with:
3636
ref: main
3737
token: ${{ steps.retrieve-bot-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
38+
persist-credentials: false
39+
fetch-depth: 0
3840

3941
- name: Check if a RC branch exists
4042
id: branch-check
@@ -43,18 +45,18 @@ jobs:
4345
rc_branch_check=$(git ls-remote --heads origin rc | wc -l)
4446
4547
if [[ "${hotfix_rc_branch_check}" -gt 0 ]]; then
46-
echo "hotfix-rc branch exists." | tee -a $GITHUB_STEP_SUMMARY
47-
echo "name=hotfix-rc" >> $GITHUB_OUTPUT
48+
echo "hotfix-rc branch exists." | tee -a "$GITHUB_STEP_SUMMARY"
49+
echo "name=hotfix-rc" >> "$GITHUB_OUTPUT"
4850
elif [[ "${rc_branch_check}" -gt 0 ]]; then
49-
echo "rc branch exists." | tee -a $GITHUB_STEP_SUMMARY
50-
echo "name=rc" >> $GITHUB_OUTPUT
51+
echo "rc branch exists." | tee -a "$GITHUB_STEP_SUMMARY"
52+
echo "name=rc" >> "$GITHUB_OUTPUT"
5153
fi
5254
5355
- name: Delete RC branch
5456
env:
5557
BRANCH_NAME: ${{ steps.branch-check.outputs.name }}
5658
run: |
5759
if ! [[ -z "$BRANCH_NAME" ]]; then
58-
git push --quiet origin --delete $BRANCH_NAME
59-
echo "Deleted $BRANCH_NAME branch." | tee -a $GITHUB_STEP_SUMMARY
60+
git push --quiet origin --delete "$BRANCH_NAME"
61+
echo "Deleted $BRANCH_NAME branch." | tee -a "$GITHUB_STEP_SUMMARY"
6062
fi

.github/workflows/code-references.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
id: check-secret-access
2020
run: |
2121
if [ "${{ secrets.AZURE_CLIENT_ID }}" != '' ]; then
22-
echo "available=true" >> $GITHUB_OUTPUT;
22+
echo "available=true" >> "$GITHUB_OUTPUT";
2323
else
24-
echo "available=false" >> $GITHUB_OUTPUT;
24+
echo "available=false" >> "$GITHUB_OUTPUT";
2525
fi
2626
2727
refs:
@@ -37,6 +37,8 @@ jobs:
3737
steps:
3838
- name: Check out repository
3939
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
with:
41+
persist-credentials: false
4042

4143
- name: Log in to Azure
4244
uses: bitwarden/gh-actions/azure-login@main
@@ -65,14 +67,14 @@ jobs:
6567

6668
- name: Add label
6769
if: steps.collect.outputs.any-changed == 'true'
68-
run: gh pr edit $PR_NUMBER --add-label feature-flag
70+
run: gh pr edit "$PR_NUMBER" --add-label feature-flag
6971
env:
7072
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7173
PR_NUMBER: ${{ github.event.pull_request.number }}
7274

7375
- name: Remove label
7476
if: steps.collect.outputs.any-changed == 'false'
75-
run: gh pr edit $PR_NUMBER --remove-label feature-flag
77+
run: gh pr edit "$PR_NUMBER" --remove-label feature-flag
7678
env:
7779
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7880
PR_NUMBER: ${{ github.event.pull_request.number }}

.github/workflows/enforce-labels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ jobs:
1717
- name: Check for label
1818
run: |
1919
echo "PRs with the hold, needs-qa or ephemeral-environment labels cannot be merged"
20-
echo "### :x: PRs with the hold, needs-qa or ephemeral-environment labels cannot be merged" >> $GITHUB_STEP_SUMMARY
20+
echo "### :x: PRs with the hold, needs-qa or ephemeral-environment labels cannot be merged" >> "$GITHUB_STEP_SUMMARY"
2121
exit 1

.github/workflows/load-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ jobs:
6363

6464
# Datadog agent for collecting OTEL metrics from k6
6565
- name: Start Datadog agent
66+
env:
67+
DD_API_KEY: ${{ steps.get-kv-secrets.outputs.DD-API-KEY }}
6668
run: |
6769
docker run --detach \
6870
--name datadog-agent \
6971
-p 4317:4317 \
7072
-p 5555:5555 \
7173
-e DD_SITE=us3.datadoghq.com \
72-
-e DD_API_KEY=${{ steps.get-kv-secrets.outputs.DD-API-KEY }} \
74+
-e DD_API_KEY="${DD_API_KEY}" \
7375
-e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=1 \
7476
-e DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT=0.0.0.0:4317 \
7577
-e DD_HEALTH_PORT=5555 \

0 commit comments

Comments
 (0)