From f3f6fb075f5f135f22b06ba013d890d29df72c0d Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:26:24 -0700 Subject: [PATCH 1/7] Image build (#4) * Remove obsolete Lambda packaging script and related configuration files - Deleted `package_lambda.py` script responsible for packaging AWS Lambda functions and layers. - Removed `pip.conf` configuration file for pip settings. - Eliminated `requirements.txt` file that specified Python dependencies. - Deleted `test_payload.json` used for testing Lambda functions. - Removed empty JSON and TFVAR files in `varfiles` directory. - Deleted `variables.tf` file containing Terraform variable definitions. - Removed `versions.tf` file specifying Terraform version requirements. - Added new GitHub Actions workflow for building and pushing Lambda container images using Packer. - Introduced `packer.pkr.hcl` file for Packer configuration to build Docker images for Lambda. * Refactor GitHub API integration to remove Census-specific references and improve configuration handling * Update Python setup in build workflow to use actions/setup-python@v4 and improve dependency installation * Add Terraform backend configuration for GCS storage * Add GOOGLE_CREDENTIALS environment variable to build workflow * Remove unused PACKER_GITHUB_API_TOKEN from build workflow environment --------- Co-authored-by: Dave Arnold --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8c23787..7f303f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,10 @@ jobs: build: runs-on: ubuntu-latest env: - PACKER_GITHUB_API_TOKEN: ${{ secrets.GH_TOKEN }} AWS_ACCESS_KEY_ID: ${{ vars.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-east-1 + GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }} steps: - uses: actions/setup-node@v3 @@ -43,7 +43,7 @@ jobs: - name: Install gtag dependencies run: | python -m pip install -r requirements.txt - + - name: Setup Terraform uses: hashicorp/setup-terraform@v3.1.2 with: @@ -100,4 +100,3 @@ jobs: -var "repository_uri=${{ env.repository_uri }}" \ -var "tag=${{ env.next_tag }}" \ packer.pkr.hcl - From a0bd23d0d31f45480700fffc322b127c7391236c Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:27:09 -0700 Subject: [PATCH 2/7] Update backend.tf --- backend.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend.tf b/backend.tf index e059210..b41413b 100644 --- a/backend.tf +++ b/backend.tf @@ -1,6 +1,6 @@ terraform { backend "gcs" { - bucket = "hpwe-terraform-state" + bucket = "hpw-terraform-state" prefix = "eks-automation-lambda" } } From 9baf9be0f8d1fc496263cbfbb794432292e80e8d Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:42:43 -0700 Subject: [PATCH 3/7] Image build (#5) * Remove obsolete Lambda packaging script and related configuration files - Deleted `package_lambda.py` script responsible for packaging AWS Lambda functions and layers. - Removed `pip.conf` configuration file for pip settings. - Eliminated `requirements.txt` file that specified Python dependencies. - Deleted `test_payload.json` used for testing Lambda functions. - Removed empty JSON and TFVAR files in `varfiles` directory. - Deleted `variables.tf` file containing Terraform variable definitions. - Removed `versions.tf` file specifying Terraform version requirements. - Added new GitHub Actions workflow for building and pushing Lambda container images using Packer. - Introduced `packer.pkr.hcl` file for Packer configuration to build Docker images for Lambda. * Refactor GitHub API integration to remove Census-specific references and improve configuration handling * Update Python setup in build workflow to use actions/setup-python@v4 and improve dependency installation * Add Terraform backend configuration for GCS storage * Add GOOGLE_CREDENTIALS environment variable to build workflow * Remove unused PACKER_GITHUB_API_TOKEN from build workflow environment * updating build --------- Co-authored-by: Dave Arnold --- .github/workflows/build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f303f3..3d45304 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,8 @@ on: workflow_dispatch: push: branches: [ "main" ] + pull_request: + branches: [ "main" ] permissions: contents: write @@ -38,7 +40,7 @@ jobs: with: python-version: '3.11' cache: 'pip' - cache-dependency-path: requirements.txt + cache-dependency-path: gtag_requirements.txt - name: Install gtag dependencies run: | @@ -74,6 +76,9 @@ jobs: uses: aws-actions/amazon-ecr-login@v2 with: mask-password: true + registry-type: public + env: + AWS_REGION: ${{ env.AWS_DEFAULT_REGION }} - name: packer init run: packer init packer.pkr.hcl From f997c1ad73815eaf8664ec2375624d1341956edd Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:51:25 -0700 Subject: [PATCH 4/7] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d45304..85f6de6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: with: python-version: '3.11' cache: 'pip' - cache-dependency-path: gtag_requirements.txt + cache-dependency-path: requirements.txt - name: Install gtag dependencies run: | From eb71291a376a8a9d6617fce2b11224b8c2ac2e52 Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:54:01 -0700 Subject: [PATCH 5/7] Image build (#6) * Remove obsolete Lambda packaging script and related configuration files - Deleted `package_lambda.py` script responsible for packaging AWS Lambda functions and layers. - Removed `pip.conf` configuration file for pip settings. - Eliminated `requirements.txt` file that specified Python dependencies. - Deleted `test_payload.json` used for testing Lambda functions. - Removed empty JSON and TFVAR files in `varfiles` directory. - Deleted `variables.tf` file containing Terraform variable definitions. - Removed `versions.tf` file specifying Terraform version requirements. - Added new GitHub Actions workflow for building and pushing Lambda container images using Packer. - Introduced `packer.pkr.hcl` file for Packer configuration to build Docker images for Lambda. * Refactor GitHub API integration to remove Census-specific references and improve configuration handling * Update Python setup in build workflow to use actions/setup-python@v4 and improve dependency installation * Add Terraform backend configuration for GCS storage * Add GOOGLE_CREDENTIALS environment variable to build workflow * Remove unused PACKER_GITHUB_API_TOKEN from build workflow environment * updating build * Remove eks_automation/data.json configuration file --------- Co-authored-by: Dave Arnold --- .github/workflows/build.yml | 2 +- eks_automation/data.json | 26 -------------------------- 2 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 eks_automation/data.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85f6de6..3d45304 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,7 @@ jobs: with: python-version: '3.11' cache: 'pip' - cache-dependency-path: requirements.txt + cache-dependency-path: gtag_requirements.txt - name: Install gtag dependencies run: | diff --git a/eks_automation/data.json b/eks_automation/data.json deleted file mode 100644 index ad8264e..0000000 --- a/eks_automation/data.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "project_name": "eks-automation-lambda-test1", - "eks_settings": { - "attrs": { - "account_name": "lab-dev-ew", - "aws_region": "us-gov-east-1", - "cluster_mailing_list": "matthew.c.morgan@census.gov", - "cluster_name": "csvd-platform-lab-mcm", - "eks_instance_disk_size": 100, - "eks_ng_desired_size": 2, - "eks_ng_max_size": 10, - "eks_ng_min_size": 2, - "environment": "development", - "environment_abbr": "dev", - "organization": "census:ocio:csvd", - "finops_project_name": "csvd_platformbaseline", - "finops_project_number": "fs0000000078", - "finops_project_role": "csvd_platformbaseline_app", - "vpc_domain_name": "dev.lab.csp2.census.gov", - "vpc_name": "vpc3-lab-dev" - }, - "tags" : { - "slim:schedule": "8:00-17:00" - } - } -} From a71b9aef16eba15a7e8b359e65cd8ee9c80fe58b Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 02:54:59 -0700 Subject: [PATCH 6/7] Update build.yml --- .github/workflows/build.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d45304..b52d6d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,8 +4,6 @@ on: workflow_dispatch: push: branches: [ "main" ] - pull_request: - branches: [ "main" ] permissions: contents: write @@ -40,7 +38,7 @@ jobs: with: python-version: '3.11' cache: 'pip' - cache-dependency-path: gtag_requirements.txt + cache-dependency-path: requirements.txt - name: Install gtag dependencies run: | From fb759b1b45e4549ec4f2c21fcc7f34c1f24901d5 Mon Sep 17 00:00:00 2001 From: David Arnold <10138997+djaboxx@users.noreply.github.com> Date: Thu, 17 Apr 2025 08:19:51 -0700 Subject: [PATCH 7/7] Update packer.pkr.hcl --- packer.pkr.hcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packer.pkr.hcl b/packer.pkr.hcl index af8805f..f4fc1d9 100644 --- a/packer.pkr.hcl +++ b/packer.pkr.hcl @@ -34,7 +34,7 @@ build { provisioner "file" { source = "./eks_automation" - destination = "/var/task/" + destination = "/var/task" } provisioner "shell" {