Skip to content

Commit

Permalink
Remove obsolete Lambda packaging script and related configuration fil…
Browse files Browse the repository at this point in the history
…es (#1)

- 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.

Co-authored-by: Dave Arnold <dave@roknsound.com>
  • Loading branch information
2 people authored and GitHub committed Apr 17, 2025
1 parent 28a1a5d commit a35b7f9
Show file tree
Hide file tree
Showing 31 changed files with 278 additions and 2,113 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build and Push Lambda Container

on:
workflow_dispatch:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: write
id-token: write

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

steps:
- uses: actions/setup-node@v3
with:
node-version: 16

- uses: actions/checkout@v4

- name: Setup HashiCorp Packer
uses: hashicorp/setup-packer@v3.1.0

- name: Download GTag
run: |
curl -sSL https://raw.githubusercontent.com/HappyPathway/centralized-actions/main/gtag.py -o gtag.py
curl -sSL https://raw.githubusercontent.com/HappyPathway/centralized-actions/main/gtag_requirements.txt -o requirements.txt
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
cache: pip

- name: Setup Terraform
uses: hashicorp/setup-terraform@v3.1.2
with:
terraform_version: 1.9.1
terraform_wrapper: false

- name: terraform init
run: terraform init

- name: terraform apply
run: terraform apply -auto-approve

- name: terraform output
id: terraform_output
run: echo "repository_uri=$(terraform output -raw repository_uri)" >> $GITHUB_ENV

- name: git fetch --unshallow --tags
run: git fetch --unshallow --tags

- name: get tags
run: git tag --list

- name: GTag
run: |
echo "next_tag=$(python gtag.py --${{ vars.increment_version }})" >> $GITHUB_ENV
- name: Docker Login to ECR
uses: aws-actions/amazon-ecr-login@v2
with:
mask-password: true

- name: packer init
run: packer init packer.pkr.hcl

- name: packer validate
run: |
packer validate \
-var "repository_uri=${{ env.repository_uri }}" \
-var "tag=${{ env.next_tag }}" \
packer.pkr.hcl
- name: set tag
run: |
remote_repo="https://${{ vars.gh_username }}:${{ secrets.GH_TOKEN }}@${{ vars.gh_server }}/${{ github.repository }}.git"
git remote add repo ${remote_repo}
git config --global user.email "${{ vars.gh_email }}"
git config --global user.name "${{ vars.gh_username }}"
git tag -a ${{ env.next_tag }} -m "Release ${{ env.next_tag }}"
git push --tags -u repo
- name: packer build
run: |
packer build \
-var "repository_uri=${{ env.repository_uri }}" \
-var "tag=${{ env.next_tag }}" \
packer.pkr.hcl
19 changes: 0 additions & 19 deletions .github/workflows/gh-token.yaml

This file was deleted.

117 changes: 0 additions & 117 deletions .github/workflows/tf-apply.yaml

This file was deleted.

42 changes: 0 additions & 42 deletions .github/workflows/tf-validate.yaml

This file was deleted.

Loading

0 comments on commit a35b7f9

Please sign in to comment.