cal-itp / eligibility-server

Server implementation of the Eligibility Verification API
https://docs.calitp.org/eligibility-server
GNU Affero General Public License v3.0
3 stars 3 forks source link

Deployment job requires an environment #480

Open angela-tran opened 1 month ago

angela-tran commented 1 month ago

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:

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

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 commented 1 month ago

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 commented 1 month ago

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.

thekaveman commented 1 month ago

@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 commented 1 month ago

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

angela-tran commented 1 month ago

Left todo: