Sign inSign up free

800. Deploy Through Protected Environments

medium 20 XP ~8 minHands-on lab

/home/student/repos/data-pipeline/.github/workflows/deploy.yml deploys to staging and then production using repository secrets, so any workflow on any branch can read the production credentials. The team created two GitHub environments, staging and production, with their own DEPLOY_TOKEN secret, and required reviewers on production.

Task

Change deploy.yml so that:

  • deploy-staging runs in the environment staging, with the URL https://staging.data-pipeline.example.com,
  • deploy-production runs in the environment production, with the URL https://data-pipeline.example.com, and only after deploy-staging succeeded,
  • each job's deploy step still reads secrets.DEPLOY_TOKEN (the environment's secret now), passed to the step as the environment variable TOKEN.

Keep the steps' commands as they are.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of CI/CD Pipelines in Practice. Next step: Clean Up and Report, Even When Tests Fail

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.