Library
REF 17Cheat Sheet · Reference

Anti-pattern quick-reference

Don't on the left, fix on the right. Read before push, scan when something behaves strangely.

Credentials & secretsIn repo = leaked
Bake creds in custom imagesUse the secrets: block; reference at runtime.
Keys in environment: on a resourceVisible in repo + learner debug log. Move to secrets:.
PAT in git clone https://<tok>@…Lives in repo history forever. Use secrets:: git clone https://${GITHUB_TOKEN}@…
Base64 dockerconfigjson in setupEquivalent to plaintext in git. Move to secrets:; decode at runtime.
Lifecycle & cleanupState that doesn't survive
Rely on nohup across challengesBackground jobs die at the challenge boundary. Run synchronously in the prior challenge’s setup.
Skip cleanup for costed resourcesOrphaned tenants, accounts, keys accumulate. Always retrieve resource ID via agent variable get and delete.
Run certbot certonly at runtimeHits LE rate limit (5/week). Use provision_ssl_certificate: true; read cert from GCP metadata.
Copy a vestigial container from an older configSome legacy workshop configs carry containers that no longer serve a function (e.g., a defunct nginx-zones helper). Inflates resource allocation. Remove from new builds.
Bash disciplineSilent failure modes
export DEBIAN_FRONTEND noninteractiveMissing =. Setup hangs on apt-get prompts. Add =: export DEBIAN_FRONTEND=noninteractive
#set -euxo pipefailComment, not command. set never executes; failures hidden. Drop the leading #.
set -eux pipefailpipefail read as a positional parameter, ignored. Pipe failures pass. Add -o: set -euxo pipefail
Cloud & IAMSandbox provisioning
Reference INSTRUQT_AWS_* with no aws_accounts:Variables come back empty; CLI fails with cryptic auth errors. Add the matching resource block.
roles: - roles/writerNot a valid GCP IAM role. Use a real one: roles/storage.objectCreator, roles/storage.objectUser.
AuthoringBody and scripts
```python,run for bash contentBlock executed as Python. Output is wrong, errors confuse. Match the language tag to what runs.
lolcat / cowsay / ponysay in scriptsANSI escapes corrupt the debug log. Reserve for terminal cmd: only.
PatternsWrong tool, wrong technique
socat for iframe-blocking sitesTCP-level proxy can’t touch HTTP headers. Use Caddy/nginx with header_down, or custom_response_headers: on the service tab.
sleep N for readinessBrittle to provisioning variance. Replace with until <readiness-check>; do sleep 10; done.
Notes