From 87f3d9c3e8ba783bbdfe85dd478afecce36938f0 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Fri, 20 Sep 2024 14:14:28 -0700 Subject: [PATCH 1/4] Action prs (#15) * adding a few repos * Update terraform_plan.yaml --- .github/workflows/terraform_plan.yaml | 2 +- github-runners.tf | 32 +++++++++++++++ image-pipeline.tf | 10 ++--- main.tf | 57 +++++++++++++++++++++++++-- 4 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 github-runners.tf diff --git a/.github/workflows/terraform_plan.yaml b/.github/workflows/terraform_plan.yaml index 4684893..13dcdbe 100644 --- a/.github/workflows/terraform_plan.yaml +++ b/.github/workflows/terraform_plan.yaml @@ -12,7 +12,7 @@ jobs: # This workflow contains a single job called "build" Plan: # The type of runner that the job will run on - runs-on: [ automation-repos ] + runs-on: [ "229685449397" ] env: AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" AWS_ACCESS_KEY_ID: "${{ vars.AWS_ACCESS_KEY_ID }}" diff --git a/github-runners.tf b/github-runners.tf new file mode 100644 index 0000000..74bce79 --- /dev/null +++ b/github-runners.tf @@ -0,0 +1,32 @@ +module "template_ecs_github_runners" { + source = "HappyPathway/repo/github" + #github_codeowners_team = "CSVD" + github_repo_description = "Terraform Workspace for creating Github Runners" + repo_org = "arnol377" + name = "template-ecs-github-runners" + github_repo_topics = [ + "terraform" + ] + is_template = true + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + pull_request_bypassers = local.pull_request_bypassers +} + +module "csvd_ecs_github_runners" { + source = "HappyPathway/repo/github" + #github_codeowners_team = "CSVD" + github_repo_description = "Terraform Workspace for creating Github Runners" + repo_org = "arnol377" + name = "csvd-ecs-github-runners" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + pull_request_bypassers = local.pull_request_bypassers +} diff --git a/image-pipeline.tf b/image-pipeline.tf index 8a3a8f3..529720c 100644 --- a/image-pipeline.tf +++ b/image-pipeline.tf @@ -17,7 +17,7 @@ module "image_pipeline_repos" { source = "HappyPathway/repo/github" #github_codeowners_team = "CSVD" github_repo_description = "Template repo for windows image pipelines" - repo_org = "arnol377" + repo_org = "CSVD" name = each.value github_repo_topics = [ "terraform" @@ -44,10 +44,10 @@ module "image_pipeline_repos" { # image-pipeline-asset-releases module "asset_releases" { - source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + source = "HappyPathway/repo/github" #github_codeowners_team = "CSVD" github_repo_description = "Terraform Workspace for publishing image-pipeline-assets" - repo_org = "arnol377" + repo_org = "CSVD" name = "image-pipeline-asset-releases" github_repo_topics = [ "terraform" @@ -64,7 +64,7 @@ module "asset_releases" { module "aws_image_pipeline" { source = "HappyPathway/repo/github" github_repo_description = "Terraform Workspace for creating and managing AWS Image Pipelines" - repo_org = "arnol377" + repo_org = "CSVD" name = "aws-image-pipeline" github_repo_topics = [ "terraform" @@ -107,7 +107,7 @@ module "aws_image_pipeline" { module "terraform_aws_image_pipeline" { source = "HappyPathway/repo/github" github_repo_description = "Terraform Module that creates codepipeline and codebuild jobs and other resources for building and deploying images" - repo_org = "arnol377" + repo_org = "CSVD" name = "terraform-aws-image-pipeline" github_repo_topics = [ "terraform" diff --git a/main.tf b/main.tf index aefe265..006b3a9 100644 --- a/main.tf +++ b/main.tf @@ -1,8 +1,8 @@ locals { collaborators = { - naray007 = "push", - morga471 = "push", - gomez385 = "push" + naray007 = "admin", + morga471 = "admin", + gomez385 = "admin" } pull_request_bypassers = [ "arnol377", @@ -47,6 +47,57 @@ module "automation-repos" { pull_request_bypassers = local.pull_request_bypassers } +# terraform-repos +module "csvd-org-management" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Automation Repos for Morpheus POC" + repo_org = "CSVD" + name = "csvd-org-management" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + pull_request_bypassers = local.pull_request_bypassers +} + +module "external-actions" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Automation Repos for Morpheus POC" + repo_org = "CSVD" + name = "external-actions" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + pull_request_bypassers = local.pull_request_bypassers +} + +module "github-runner-images" { + source = "git@github.e.it.census.gov:CSVD/terraform-github-repo" + #github_codeowners_team = "CSVD" + github_repo_description = "Github Runner Images Import" + repo_org = "CSVD" + name = "github-runner-images" + github_repo_topics = [ + "terraform" + ] + force_name = true + create_codeowners = false + enforce_prs = false + collaborators = local.collaborators + pull_request_bypassers = local.pull_request_bypassers +} + + + # centralized-actions module "centralized-actions" { source = "HappyPathway/repo/github" From 7be0c8c04fc7fa9bdc95a3c6038dd2862b668320 Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Mon, 23 Sep 2024 10:49:20 -0700 Subject: [PATCH 2/4] Create echo_vars.yaml --- .github/workflows/echo_vars.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/echo_vars.yaml diff --git a/.github/workflows/echo_vars.yaml b/.github/workflows/echo_vars.yaml new file mode 100644 index 0000000..ead63f9 --- /dev/null +++ b/.github/workflows/echo_vars.yaml @@ -0,0 +1,17 @@ +# This is a basic workflow to help you get started with Actions +name: Terraform Plan + +# Controls when the workflow will run +on: + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + Plan: + # The type of runner that the job will run on + runs-on: [ "229685449397" ] + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - run: | + env | grep -i proxy From 1b1886b5123e89ba9e97a893b622eec564431cbf Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Mon, 23 Sep 2024 10:49:55 -0700 Subject: [PATCH 3/4] Update echo_vars.yaml --- .github/workflows/echo_vars.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/echo_vars.yaml b/.github/workflows/echo_vars.yaml index ead63f9..192fd5a 100644 --- a/.github/workflows/echo_vars.yaml +++ b/.github/workflows/echo_vars.yaml @@ -1,5 +1,5 @@ # This is a basic workflow to help you get started with Actions -name: Terraform Plan +name: Echo Vars # Controls when the workflow will run on: @@ -8,7 +8,7 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" - Plan: + Echo: # The type of runner that the job will run on runs-on: [ "229685449397" ] # Steps represent a sequence of tasks that will be executed as part of the job From f470ae6ec7aba83ad6c2a774a930e8eac934603a Mon Sep 17 00:00:00 2001 From: David John Arnold Jr Date: Mon, 23 Sep 2024 11:09:26 -0700 Subject: [PATCH 4/4] Update terraform_apply.yaml --- .github/workflows/terraform_apply.yaml | 28 +++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/terraform_apply.yaml b/.github/workflows/terraform_apply.yaml index b48c1ce..b70698e 100644 --- a/.github/workflows/terraform_apply.yaml +++ b/.github/workflows/terraform_apply.yaml @@ -13,20 +13,15 @@ jobs: # This workflow contains a single job called "build" Apply: # The type of runner that the job will run on - runs-on: [ automation-repos ] + runs-on: [ "229685449397" ] env: - AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" - AWS_ACCESS_KEY_ID: "${{ vars.AWS_ACCESS_KEY_ID }}" - AWS_DEFAULT_REGION: "${{ vars.AWS_DEFAULT_REGION }}" - GITHUB_TOKEN: "${{ secrets.GH_TOKEN }}" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - - uses: CSVD/gh-actions-setup-node@v3 with: node-version: 16 @@ -35,15 +30,6 @@ jobs: with: terraform_wrapper: false terraform_version: ${{ vars.terraform_version }} - - - name: Terraform Format - id: fmt - run: | - terraform fmt -check - - - name: Autoformat Halt - if: env.auto_format == 'true' - run: exit 1 - name: Terraform Init id: init @@ -53,7 +39,11 @@ jobs: id: validate run: terraform validate - - name: Terraform Apply + - name: Terraform Plan id: plan - run: terraform apply -auto-approve - continue-on-error: true + run: terraform validate + +# - name: Terraform Apply +# id: plan +# run: terraform apply -auto-approve +# continue-on-error: true