Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment job requires an environment #480

Open
angela-tran opened this issue Jul 11, 2024 · 5 comments
Open

Deployment job requires an environment #480

angela-tran opened this issue Jul 11, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@angela-tran
Copy link
Member

angela-tran commented Jul 11, 2024

edit: the pipeline is now working with #481. This ticket is still open because we could try to make the naming / deployment history on our Azure DevOps Environments a little more intuitive. See the second solution described below.


The infra pipeline is currently not able to run. The actual eligibility servers are still up and running, so this is not causing an outage, but we should get the infra pipeline back to working ASAP.

To Reproduce

Steps to reproduce the behavior:

  1. Go to Azure DevOps
  2. View recent infra pipeline runs
  3. See error about the job requiring an Environment

Expected behavior

The infra pipeline succeeds.

Environment

Affects the infra pipeline only

Agency

Applies to infra pipelines for all agencies

Additional context

I removed the Approval environment from the Apply deployment job in #477 in an attempt to have it run without needing our manual approval, but that is not how it works.

Environments in Azure DevOps represent a collection of resources that you might want to deploy to, for example maybe a VM or a Kubernetes environment. The Environment does not actually need to hold any resources, but it can. A use case for having an empty Environment is so you can use other features that it provides like deployment history and manual approvals.

A deployment job is a special type of job, and when it runs, it adds to the deployment history of the Environment that it is associated with. Therefore it requires an Environment.

The simplest way to remove approvals:

  • add back environment: Approval to the Apply job
  • edit the Approval environment to not require any approvals (screenshot of configuration screen below)

An alternate way which requires more changes, but uses Environments in a way that maybe makes more sense:

  • create 3 new Environments: Dev, Test, and Prod - none of which require approval
  • in terraform/pipeline/deploy.yml, derive the correct Environment name and store it in a variable
  • set the environment on the Apply job using that variable
  • delete the Approval environment

With this alternate way, we would be able to see the deployment history for each environment separately instead of all in one. Current deployment history on Approval is for all 3:
image

@thekaveman
Copy link
Member

An alternate way which requires more changes, but uses Environments in a way that maybe makes more sense

I think this makes a lot of sense! I know it's a bit more work but I feel like it would be useful to know how to set this up.

@angela-tran
Copy link
Member Author

angela-tran commented Jul 11, 2024

in terraform/pipeline/deploy.yml, derive the correct Environment name and store it in a variable

I tried using a variable in #483, but the tricky part is that environment is set during compile time while our logic for looking at the branch / tag names is done at runtime.

@angela-tran angela-tran moved this from In progress to Paused in Digital Services Jul 11, 2024
@angela-tran angela-tran removed their assignment Jul 11, 2024
@angela-tran angela-tran changed the title Infra pipeline is broken - deployment job requires an environment Deployment job requires an environment Jul 11, 2024
@thekaveman
Copy link
Member

@angela-tran if it's proving to be too much work, the single environment (without approval) is totally fine! Maybe we just rename it to Deployment or something like that to indicate approval is removed.

@angela-tran
Copy link
Member Author

@thekaveman Sounds good, I was thinking the same thing. Thanks!

@angela-tran angela-tran moved this from Paused to In progress in Digital Services Jul 12, 2024
@angela-tran angela-tran self-assigned this Jul 12, 2024
@angela-tran
Copy link
Member Author

Left todo:

  • Rename Environment in MST and SBMTD Azure DevOps to "Deployment"
  • Make code change in terraform/pipeline/deploy.yml

@angela-tran angela-tran moved this from In progress to Paused in Digital Services Aug 8, 2024
@angela-tran angela-tran removed their assignment Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Paused
Development

No branches or pull requests

2 participants