Skip to content

feat: add infra-helm-chart seed job #14

feat: add infra-helm-chart seed job

feat: add infra-helm-chart seed job #14

Workflow file for this run

---
# This workflow will be triggered to build the custom AMI using Packer on
# Github Actions using the Hashicorp Configuration Language (HCL2)
name: Build custom AMI using Packer
on:
workflow_dispatch:
push:
branches: [master]
jobs:
# Packer init, validate and build
build:
runs-on: ubuntu-latest
environment: ${{ vars.ENVIRONMENT }}
name: Build AWS Custom AMI for Jenkins (w/ Caddy)
steps:
- uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- name: Create & configure Packer variables
run: |
touch ami.pkrvars.hcl
echo ami_prefix=\"${{ vars.AMI_PREFIX }}\" >> ami.pkrvars.hcl
echo OS=\"${{ vars.OS }}\" >> ami.pkrvars.hcl
echo ubuntu_version=\"${{ vars.UBUNTU_VERSION }}\" >> ami.pkrvars.hcl
echo ssh_username=\"${{ vars.SSH_USERNAME }}\" >> ami.pkrvars.hcl
echo subnet_id=\"${{ secrets.SUBNET_ID }}\" >> ami.pkrvars.hcl
echo source_ami=\"${{ vars.SOURCE_AMI }}\" >> ami.pkrvars.hcl
echo aws_region=\"${{ vars.AWS_REGION }}\" >> ami.pkrvars.hcl
echo instance_type=\"${{ vars.INSTANCE_TYPE}}\" >> ami.pkrvars.hcl
echo volume_size=\"${{ vars.VOLUME_SIZE}}\" >> ami.pkrvars.hcl
echo volume_type=\"${{ vars.VOLUME_TYPE}}\" >> ami.pkrvars.hcl
echo device_name=\"${{ vars.DEVICE_NAME}}\" >> ami.pkrvars.hcl
- name: Setup `packer`
uses: hashicorp/setup-packer@main
id: setup
with:
version: "latest"
- name: Packer format
id: fmt
run: "packer fmt ."
- name: Packer init
id: init
run: "packer init ubuntu.ami.pkr.hcl"
- name: Validate packer template
id: validate
run: "packer validate -evaluate-datasources \
-var 'ami_users=${{ secrets.AMI_USERS }}' \
--var-file=ami.pkrvars.hcl ubuntu.ami.pkr.hcl"
- name: Build AMI using Packer
id: build
run: "packer build \
-var 'ami_users=${{ secrets.AMI_USERS }}' \
--var-file=ami.pkrvars.hcl ubuntu.ami.pkr.hcl"