Skip to content

Commit ca6b0ba

Browse files
Copilotcommjoen
andcommitted
Fix preview deployment workflow variable expansion
Co-authored-by: commjoen <1457214+commjoen@users.noreply.github.com>
1 parent 4cb7ff2 commit ca6b0ba

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

.github/workflows/preview.yml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -116,65 +116,71 @@ jobs:
116116
117117
- name: Create deployment instructions
118118
id: instructions
119+
env:
120+
IMAGE_PREFIX: ${{ env.IMAGE_PREFIX }}
121+
TAG: ${{ needs.set-tag.outputs.tag }}
122+
PR_NUMBER: ${{ github.event.number }}
123+
REPO_OWNER: ${{ github.repository_owner }}
124+
VALUES_CONTENT: ${{ steps.values.outputs.values }}
119125
run: |
120126
# yamllint disable rule:line-length
121-
cat > instructions.md << 'EOF'
127+
cat > instructions.md << EOF
122128
## 🚀 Preview Deployment Ready!
123129
124130
Your pull request has been built and is ready for preview deployment.
125131
Here's how to test your changes:
126132
127133
### Container Images Built
128134
129-
- **Balancer**: `${{ env.IMAGE_PREFIX }}/wrongsecrets-balancer:${{ needs.set-tag.outputs.tag }}`
130-
- **Cleaner**: `${{ env.IMAGE_PREFIX }}/cleaner:${{ needs.set-tag.outputs.tag }}`
135+
- **Balancer**: \`${IMAGE_PREFIX}/wrongsecrets-balancer:${TAG}\`
136+
- **Cleaner**: \`${IMAGE_PREFIX}/cleaner:${TAG}\`
131137
132138
### Quick Deploy with Helm
133139
134-
```bash
140+
\`\`\`bash
135141
# Add the wrongsecrets helm repository
136142
helm repo add wrongsecrets https://owasp.org/wrongsecrets-ctf-party
137143
helm repo update
138144
139145
# Deploy with preview images
140-
helm install my-preview wrongsecrets/wrongsecrets-ctf-party \
141-
--set balancer.repository=${{ env.IMAGE_PREFIX }}/wrongsecrets-balancer \
142-
--set balancer.tag=${{ needs.set-tag.outputs.tag }} \
143-
--set wrongsecretsCleanup.repository=${{ env.IMAGE_PREFIX }}/cleaner \
144-
--set wrongsecretsCleanup.tag=${{ needs.set-tag.outputs.tag }} \
146+
helm install my-preview wrongsecrets/wrongsecrets-ctf-party \\
147+
--set balancer.repository=${IMAGE_PREFIX}/wrongsecrets-balancer \\
148+
--set balancer.tag=${TAG} \\
149+
--set wrongsecretsCleanup.repository=${IMAGE_PREFIX}/cleaner \\
150+
--set wrongsecretsCleanup.tag=${TAG} \\
145151
--set imagePullPolicy=Always
146152
147153
# Port forward to access locally
148154
kubectl port-forward service/wrongsecrets-balancer 3000:3000
149-
```
155+
\`\`\`
150156
151157
### Deploy with Custom Values
152158
153159
<details>
154160
<summary>Click to see preview-values.yaml</summary>
155161
156-
```yaml
157-
${{ steps.values.outputs.values }}
158-
```
162+
\`\`\`yaml
163+
${VALUES_CONTENT}
164+
\`\`\`
159165
160166
</details>
161167
162-
```bash
168+
\`\`\`bash
163169
# Save the above values to preview-values.yaml, then:
164-
helm install my-preview wrongsecrets/wrongsecrets-ctf-party \
170+
helm install my-preview wrongsecrets/wrongsecrets-ctf-party \\
165171
-f preview-values.yaml
166-
```
172+
\`\`\`
167173
168174
### Deploy with Local Build Scripts
169175
170-
```bash
176+
\`\`\`bash
171177
# Clone this PR
172-
git fetch origin pull/${{ github.event.number }}/head:pr-${{ github.event.number }}
173-
git checkout pr-${{ github.event.number }}
178+
git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
179+
git checkout pr-${PR_NUMBER}
174180
175181
# Use the existing deployment script with custom images
176182
./build-and-deploy.sh
177-
```
183+
\`\`\`
178184
179185
### Test the Changes
180186
@@ -185,18 +191,18 @@ jobs:
185191
### Container Registry
186192
187193
The preview images are available at:
188-
- https://github.com/${{ github.repository_owner }}/wrongsecrets-ctf-party/pkgs/container/wrongsecrets-balancer
189-
- https://github.com/${{ github.repository_owner }}/wrongsecrets-ctf-party/pkgs/container/cleaner
194+
- https://github.com/${REPO_OWNER}/wrongsecrets-ctf-party/pkgs/container/wrongsecrets-balancer
195+
- https://github.com/${REPO_OWNER}/wrongsecrets-ctf-party/pkgs/container/cleaner
190196
191197
---
192198
193-
*This preview was automatically generated for PR #${{ github.event.number }}*
199+
*This preview was automatically generated for PR #${PR_NUMBER}*
194200
EOF
195201
# yamllint enable rule:line-length
196202
197-
echo "content<<EOF" >> $GITHUB_OUTPUT
198-
cat instructions.md >> $GITHUB_OUTPUT
199-
echo "EOF" >> $GITHUB_OUTPUT
203+
echo "content<<EOF" >> \$GITHUB_OUTPUT
204+
cat instructions.md >> \$GITHUB_OUTPUT
205+
echo "EOF" >> \$GITHUB_OUTPUT
200206
201207
- name: Comment on PR
202208
uses: actions/github-script@v7

0 commit comments

Comments
 (0)