-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Issue #1546] Deploy Analytics folder to AWS ECR #1566
Merged
Merged
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
33b490b
checkpoint-kai-1711402661
coilysiren b53a249
git restore
coilysiren a07bafd
add docker files
coilysiren 5501a50
checkpoint-kai-1711405786
coilysiren 86579db
PYTHONPATH
coilysiren 3fafefe
ANALYTICS_SLACK_BOT_TOKEN
coilysiren c2e4ff3
ANALYTICS_REPORTING_CHANNEL_ID
coilysiren be474a1
local.env
coilysiren 1e68afd
install gh CLI
coilysiren 132a3d2
gh CLI login process working
coilysiren 1ea2610
workon env vars
coilysiren dabd384
Merge branch 'main' into analytics-docker
coilysiren f062dfc
Merge branch 'main' into analytics-docker
coilysiren 854a780
Merge branch 'main' into analytics-docker
coilysiren acaa594
Update Dockerfile
coilysiren 2746bee
docs
coilysiren 585c40e
remove copied code
coilysiren 77139c1
add to development.md
coilysiren 89ebb70
Merge branch 'main' into analytics-ecr
coilysiren 51d8997
Merge branch 'main' into analytics-docker
coilysiren 364d927
Merge branch 'analytics-docker' into analytics-ecr
coilysiren a44c1f7
Merge branch 'main' into analytics-ecr
coilysiren 673af65
Add ECR repo
coilysiren de6f08f
test deploy
coilysiren ffe1730
testing
coilysiren 8442c21
test secrets
coilysiren ee3e74b
has_database
coilysiren d3c2798
remove testing change
coilysiren 5c33190
remove testing change
coilysiren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Deploy Analytics | ||
# 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 ${{ github.ref_name }} to Analytics ${{ inputs.environment || (github.event_name == 'release' && 'prod') || 'dev' }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "analytics/**" | ||
# TEMPORARY: for testing purposes! | ||
pull_request: | ||
paths: | ||
- .github/workflows/cd-analytics.yml | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
description: "target environment" | ||
required: true | ||
default: "dev" | ||
type: choice | ||
options: | ||
- dev | ||
- staging | ||
- prod | ||
|
||
jobs: | ||
analytics-checks: | ||
name: Run Analyics Checks | ||
uses: ./.github/workflows/ci-analytics.yml | ||
|
||
deploy: | ||
name: Deploy | ||
needs: analytics-checks | ||
uses: ./.github/workflows/deploy.yml | ||
with: | ||
app_name: "analytics" | ||
environment: ${{ inputs.environment || (github.event_name == 'release' && 'prod') || 'dev' }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
data "aws_iam_role" "github_actions" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Copied from |
||
name = module.project_config.github_actions_role_name | ||
} | ||
|
||
locals { | ||
# Set project tags that will be used to tag all resources. | ||
tags = merge(module.project_config.default_tags, { | ||
application = module.app_config.app_name | ||
application_role = "build-repository" | ||
description = "Backend resources required for storing built release candidate artifacts to be used for deploying to environments." | ||
}) | ||
|
||
# Get list of AWS account ids for the application environments that | ||
# will need access to the build repository | ||
app_account_names = values(module.app_config.account_names_by_environment) | ||
account_ids_by_name = data.external.account_ids_by_name.result | ||
app_account_ids = [for account_name in local.app_account_names : local.account_ids_by_name[account_name] if contains(keys(local.account_ids_by_name), account_name)] | ||
} | ||
|
||
terraform { | ||
required_version = ">= 1.2.0, < 2.0.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 5.34.0" | ||
} | ||
} | ||
|
||
backend "s3" { | ||
encrypt = "true" | ||
} | ||
} | ||
|
||
provider "aws" { | ||
region = module.app_config.build_repository_config.region | ||
default_tags { | ||
tags = local.tags | ||
} | ||
} | ||
|
||
module "project_config" { | ||
source = "../../project-config" | ||
} | ||
|
||
module "app_config" { | ||
source = "../app-config" | ||
} | ||
|
||
data "external" "account_ids_by_name" { | ||
program = ["../../../bin/account-ids-by-name.sh"] | ||
} | ||
|
||
module "container_image_repository" { | ||
source = "../../modules/container-image-repository" | ||
name = module.app_config.image_repository_name | ||
push_access_role_arn = data.aws_iam_role.github_actions.arn | ||
app_account_ids = local.app_account_ids | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bucket = "simpler-grants-gov-315341936575-us-east-1-tf" | ||
key = "infra/analytics/build-repository/shared.tfstate" | ||
dynamodb_table = "simpler-grants-gov-315341936575-us-east-1-tf-state-locks" | ||
region = "us-east-1" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied from
.github/workflows/cd-api.yml