[WIP]Add packer support for building AWS AMI #14
Workflow file for this run
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
name: Build AWS Neuron AMI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'infrastructure/ami/**' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'infrastructure/ami/**' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to use for the AMI build' | |
default: 'main' | |
schedule: | |
# Schedule the workflow to run every second day at midnight UTC | |
- cron: '0 0 */2 * *' | |
jobs: | |
build-ami: | |
defaults: | |
run: | |
working-directory: infrastructure/ami | |
runs-on: ubuntu-latest | |
env: | |
AWS_DEFAULT_REGION: us-east-1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.inputs.tag}} | |
- name: Setup Packer | |
uses: hashicorp/setup-packer@main | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
- name: Packer format | |
id: format | |
run: packer fmt hcl2-files | |
continue-on-error: true | |
- name: Packer Init | |
id: init | |
run: packer init hcl2-files | |
continue-on-error: true | |
- name: Packer Validate | |
id: validate | |
run: packer validate hcl2-files | |
continue-on-error: true | |
- name: Packer Build | |
id: build | |
run: | | |
packer build -var "optimum_version=${{ steps.determine-tag.outputs.TAG }}" -var "region=${{ env.AWS_DEFAULT_REGION }}" hcl2-files | |
- name: Slack Notification on Failure | |
id: slack | |
uses: slackapi/[email protected] | |
if: ${{ failure() && github.event_name == 'schedule' }} | |
with: | |
channel-id: 'C06GAEQJLNN' #copied from slack channel | |
payload: | | |
{ | |
"text": "GitHub Action HuggingFace Neuron AMI Build result: ${{job.status}}" | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_CIFEEDBACK_BOT_TOKEN }} |