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

Support Platform CLI #763

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
8aee09e
Add copier files
lorenyu Oct 3, 2024
a44b003
Templatize app_name
lorenyu Oct 3, 2024
2811ba0
Rename e2e/app to e2e/{{app_name}}
lorenyu Oct 18, 2024
f7661c4
Merge branch 'main' into lorenyu/platform-cli
lorenyu Oct 18, 2024
3f649ef
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Oct 24, 2024
10eea5b
Update cd-{{app_name}}.yml to parameterize job name
doshitan Oct 28, 2024
37cc0d1
Parameterize workflows/ci-{{app_name}}* content for app_name
doshitan Oct 28, 2024
c1aa4cb
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Oct 30, 2024
58bd26f
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Oct 30, 2024
11076e5
WIP try local port setting
doshitan Nov 1, 2024
1120558
Have app vuln scans run on any changes to underlying action (as was o…
doshitan Nov 1, 2024
9252220
Support conditional blocks based on if dev env is available
doshitan Nov 1, 2024
0097c5b
Make infra service checks per-app?
doshitan Nov 4, 2024
fcff0d1
Dummy change for updating
doshitan Nov 4, 2024
0733d96
Use `/health` endpoint for check in infra_test.go
doshitan Nov 5, 2024
f2d5e34
Disable TLS checks in infra_test.go
doshitan Nov 5, 2024
dd8a1c7
Update docs for broken links and consistently use <APP_NAME>
doshitan Nov 5, 2024
a023ba3
Update decision docs for template usage
doshitan Nov 5, 2024
81f514d
More broken doc link updates
doshitan Nov 5, 2024
37a2962
More broken doc link updates
doshitan Nov 5, 2024
b6f626e
Update template-infra's infra check to install example project to run…
doshitan Nov 5, 2024
46a4114
Merge branch 'main' into lorenyu/platform-cli
doshitan Nov 6, 2024
25904e1
Pull infra/project-config/main.tf into template
doshitan Nov 6, 2024
4ad924a
Fix doc link lint due to project-config templating
doshitan Nov 7, 2024
f968f02
Fix IMAGE_TAG when not in a git repo
doshitan Nov 7, 2024
c44ae5a
template_infra_test.go: Build the IMAGE_TAG specified
doshitan Nov 7, 2024
536a572
bin/check-github-actions-auth: be explicit about the repo to check
doshitan Nov 7, 2024
2e39545
template_infra_test.go: comment on not using /health
doshitan Nov 7, 2024
c53219c
Prefix all copier variables with template part name (base or app)
doshitan Nov 7, 2024
5ab08b3
Only ask relevant questions for different template
doshitan Nov 7, 2024
c5f90fa
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 9, 2024
4c61efd
misc. doc updates
doshitan Nov 8, 2024
aba8076
move app/ to template-only-app/
doshitan Nov 8, 2024
46b5777
Fix documented update commands
doshitan Nov 12, 2024
a602c81
app_is_dev_env_setup -> app_has_dev_env_setup
doshitan Nov 12, 2024
3f86171
Question tweaks
doshitan Nov 12, 2024
5532b10
fixes for app/ -> template-only-app/
doshitan Nov 12, 2024
6ad105d
More app -> <APP_NAME> doc updates
doshitan Nov 12, 2024
de5a358
Template-ize infra/networks/main.tf
doshitan Nov 12, 2024
7ab97e1
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 13, 2024
306b1a6
Ignore broken link for networks/main.tf that will exist for installed…
doshitan Nov 13, 2024
e8436f5
Update example app in platform-test in CD
doshitan Nov 12, 2024
35a5004
misc. doc fix
doshitan Nov 13, 2024
d15e09c
doc updates
doshitan Nov 14, 2024
1cbab23
Update template CI/CD stuff to not checkout lorenyu/platform-cli
doshitan Nov 14, 2024
a666a9c
Reduce some duplication on platform-cli install
doshitan Nov 14, 2024
a0a33b4
Remove TODO from non-template-only docs
doshitan Nov 14, 2024
cddd7db
Fix a couple template-only CI things from recent change
doshitan Nov 14, 2024
66b4f27
Specify `--version` in CI for platform-cli
doshitan Nov 14, 2024
370470a
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 15, 2024
6e771c4
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 18, 2024
8741639
More doc updates
doshitan Nov 14, 2024
a56021a
bin/update-pr-environment: Support multiple apps in comments
doshitan Nov 14, 2024
4336bd0
Clean up older single-app section of PR Env info if present
doshitan Nov 18, 2024
50de31c
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 18, 2024
9f20240
Merge branch 'main' into lorenyu/platform-cli
doshitan Nov 18, 2024
856e8aa
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 26, 2024
4902094
remove feature flags due to evidently deprecation
coilysiren Nov 27, 2024
ccc8cab
remove feature flags due to evidently deprecation (part 2)
coilysiren Nov 27, 2024
7053f3d
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Nov 27, 2024
697aac4
resolve merge conflicts against main
coilysiren Dec 9, 2024
383a253
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Dec 9, 2024
2693314
Build out docs/release.md a little bit
doshitan Nov 19, 2024
494f7c3
Exclude template-only files that aren't tagged as such in the name
doshitan Dec 2, 2024
82ec64a
Remove old install/update scripts
doshitan Dec 2, 2024
e61b207
Fix destroy-pr-environment for multi-app PR env setup
doshitan Dec 9, 2024
88164a5
e2e doc fixes/consistency
doshitan Dec 10, 2024
035ef09
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Dec 20, 2024
43b79c6
Merge remote-tracking branch 'origin/main' into lorenyu/platform-cli
nava-platform-bot Dec 20, 2024
68a122d
Merge branch 'main' into lorenyu/platform-cli
lorenyu Dec 20, 2024
7fb0495
Fix custom setup-terraform usage in `template-only-ci-infra.yml`
doshitan Dec 24, 2024
4c38ade
adds: infra/{{app_name}}/service/identity_provider.tf
coilysiren Jan 2, 2025
b68e666
Merge remote-tracking branch 'origin' into lorenyu/platform-cli
coilysiren Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/actions/setup-terraform/action.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: 'Set up Terraform'
description: 'Set up Terraform with the version stored in the .terraform-version file'
name: "Set up Terraform"
description: "Set up Terraform with the version stored in the .terraform-version file"
inputs:
version-file:
description: "File containing the terraform version to use."
default: ".terraform-version"
runs:
using: "composite"
steps:
- name: Get .terraform-version
- name: Get Terraform version
id: get-terraform-version
run: |
terraform_version="$(cat .terraform-version)"
terraform_version="$(cat ${{ inputs.version-file }})"
echo "Terraform version: ${terraform_version}"
echo "terraform_version=${terraform_version}" >> "$GITHUB_OUTPUT"
shell: bash
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ The CI/CD for this project uses [reusable Github Actions workflows](https://docs

Each app should have:

- `ci-[app_name]`: must be created; should run linting and testing
- `ci-[app_name]-vulnerability-scans`: calls `vulnerability-scans`
- Based on [ci-app-vulnerability-scans](https://github.com/navapbc/template-infra/blob/main/.github/workflows/ci-app-vulnerability-scans.yml)
- `ci-[app_name]-pr-environment-checks.yml`: calls `pr-environment-checks.yml` to create or update a pull request environment (see [pull request environments](/docs/infra/pull-request-environments.md))
- Based on [ci-app-pr-environment-checks.yml](/.github/workflows/ci-app-pr-environment-checks.yml)
- `ci-[app_name]-pr-environment-destroy.yml`: calls `pr-environment-destroy.yml` to destroy the pull request environment (see [pull request environments](/docs/infra/pull-request-environments.md))
- Based on [ci-app-pr-environment-destroy.yml](https://github.com/navapbc/template-infra/blob/main/.github/workflows/ci-app-pr-environment-destroy.yml)
- `ci-<APP_NAME>`: must be created; should run linting and testing
- `ci-<APP_NAME>-vulnerability-scans`: calls `vulnerability-scans`
- Based on [ci-{{app_name}}-vulnerability-scans](https://github.com/navapbc/template-infra/blob/lorenyu%2Fplatform-cli/.github/workflows/ci-{{app_name}}-vulnerability-scans.yml.jinja)
- `ci-<APP_NAME>-pr-environment-checks.yml`: calls `pr-environment-checks.yml` to create or update a pull request environment (see [pull request environments](/docs/infra/pull-request-environments.md))
- Based on [ci-{{app_name}}-pr-environment-checks.yml](https://github.com/navapbc/template-infra/blob/lorenyu%2Fplatform-cli/.github/workflows/ci-{{app_name}}-pr-environment-checks.yml.jinja)
- `ci-<APP_NAME>-pr-environment-destroy.yml`: calls `pr-environment-destroy.yml` to destroy the pull request environment (see [pull request environments](/docs/infra/pull-request-environments.md))
- Based on [ci-{{app_name}}-pr-environment-destroy.yml](https://github.com/navapbc/template-infra/blob/lorenyu%2Fplatform-cli/.github/workflows/ci-{{app_name}}-pr-environment-destroy.yml.jinja)

### App-agnostic workflows

Expand All @@ -26,8 +26,8 @@ Each app should have:

Each app should have:

- `cd-[app_name]`: deploys an application
- Based on [`cd-app`](https://github.com/navapbc/template-infra/blob/main/.github/workflows/cd-app.yml)
- `cd-<APP_NAME>`: deploys an application
- Based on [`cd-{{app_name}}`](https://github.com/navapbc/template-infra/blob/lorenyu%2Fplatform-cli/.github/workflows/cd-{{app_name}}.yml.jinja)

The CD workflow uses these reusable workflows:

Expand All @@ -47,4 +47,4 @@ graph TD

## ⛑️ Helper workflows

- [`check-ci-cd-auth`](./check-ci-cd-auth.yml): verifes that the project's Github repo is able to connect to AWS
- [`check-ci-cd-auth`](./check-ci-cd-auth.yml): verifies that the project's Github repo is able to connect to AWS
38 changes: 0 additions & 38 deletions .github/workflows/cd-app.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/cd-{{app_name}}.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Deploy {{ app_name }}
# Need to set a default value for when the workflow is triggered from a git push
# which bypasses the default configuration for inputs
run-name: Deploy ${{'{{'}}inputs.version || 'main' {{'}}'}} to {{ app_name }} ${{'{{'}} inputs.environment || 'dev' {{'}}'}}

on:
{% if app_has_dev_env_setup %}
push:
branches:
- "main"
paths:
- "{{ app_name }}/**"
- "bin/**"
- "infra/**"
{% else %}
# !! Once you've set up the dev environment and are ready to enable continuous
# deployment, run:
#
# nava-platform infra update --data app_has_dev_env_setup=true .
#
# to enable these lines. They are here as comments for context.
#
# push:
# branches:
# - "main"
# paths:
# - "{{ app_name }}/**"
# - "bin/**"
# - "infra/**"
{% endif %}
workflow_dispatch:
inputs:
environment:
description: Environment to deploy to
required: true
default: "dev"
type: choice
options:
- dev
- staging
- prod
version:
required: true
default: "main"
description: Tag or branch or SHA to deploy

jobs:
deploy:
name: Deploy
uses: ./.github/workflows/deploy.yml
with:
app_name: "{{ app_name }}"
environment: ${{'{{'}} inputs.environment || 'dev' {{'}}'}}
version: ${{'{{'}} inputs.version || 'main' {{'}}'}}
22 changes: 0 additions & 22 deletions .github/workflows/ci-app-pr-environment-checks.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/ci-app-pr-environment-destroy.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/workflows/ci-app-vulnerability-scans.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/ci-infra-service.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/ci-{{app_name}}-infra-service.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI Infra Service Checks - {{ app_name }}

on:
{% if app_has_dev_env_setup %}
push:
branches:
- main
paths:
- infra/{{ app_name }}/service/**
- infra/modules/**
- infra/test/**
- .github/workflows/ci-{{ app_name }}-infra-service.yml
pull_request:
paths:
- infra/{{ app_name }}/service/**
- infra/modules/**
- infra/test/**
- .github/workflows/ci-{{ app_name }}-infra-service.yml
{% else %}
# !! Once you've set up the dev environment and are ready to enable automated
# infra tests, run:
#
# nava-platform infra update --data app_has_dev_env_setup=true .
#
# to enable these lines. They are here as comments for context.
#
# push:
# branches:
# - main
# paths:
# - infra/{{ app_name }}/service/**
# - infra/modules/**
# - infra/test/**
# - .github/workflows/ci-infra-service.yml
# pull_request:
# paths:
# - infra/{{ app_name }}/service/**
# - infra/modules/**
# - infra/test/**
# - .github/workflows/ci-infra-service.yml
{% endif %}
workflow_dispatch:

jobs:
infra-test-e2e:
name: Test service
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Terraform
uses: ./.github/actions/setup-terraform

- uses: actions/setup-go@v5
with:
go-version: ">=1.19.0"

- name: Configure AWS credentials
uses: ./.github/actions/configure-aws-credentials
with:
app_name: {{ app_name }}
# Run infra CI on dev environment
environment: dev

- name: Run Terratest
run: make infra-test-service APP_NAME={{ app_name }}
33 changes: 33 additions & 0 deletions .github/workflows/ci-{{app_name}}-pr-environment-checks.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI {{ app_name }} PR Environment Checks
on:
workflow_dispatch:
inputs:
pr_number:
required: true
type: string
commit_hash:
required: true
type: string
{% if app_has_dev_env_setup %}
pull_request:
{% else %}
# !! Once you've set up the dev environment and are ready to enable PR
# environments, run:
#
# nava-platform infra update --data app_has_dev_env_setup=true .
#
# to enable these lines. They are here as comments for context.
#
# pull_request:
{% endif %}

jobs:
update:
name: " " # GitHub UI is noisy when calling reusable workflows, so use whitespace for name to reduce noise
uses: ./.github/workflows/pr-environment-checks.yml
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.state == 'open'
with:
app_name: "{{ app_name }}"
environment: "dev"
pr_number: ${{'{{'}} inputs.pr_number || github.event.number {{'}}'}}
commit_hash: ${{'{{'}} inputs.commit_hash || github.event.pull_request.head.sha {{'}}'}}
Loading
Loading