Skip to content

Renaming from 'hashicorp-aws' to 'hashistack' #161

Renaming from 'hashicorp-aws' to 'hashistack'

Renaming from 'hashicorp-aws' to 'hashistack' #161

Workflow file for this run

# Copyright Jiaqi Liu
---
name: CI/CD
"on":
pull_request:
push:
branches:
- master
jobs:
cancel-previous:
name: Cancel Previous Runs In Order to Allocate Action Resources Immediately for Current Run
runs-on: ubuntu-latest
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.10.1
if: ${{github.ref != 'refs/head/master'}}
with:
access_token: ${{ github.token }}
test-example:
uses: ./.github/workflows/test-plugin-example.yml
# referencing release.yml - get-go-version
get-go-version:
runs-on: ubuntu-latest
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: 'Determine Go version'
id: get-go-version
run: |
echo "Found Go $(cat .go-version)"
echo "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
gorelease-config-check:
name: Checking if gorelease configuration is valid
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt update
sudo apt install goreleaser -y
goreleaser check .goreleaser.yml
tests:
name: Go Tests
needs: [test-example, get-go-version, gorelease-config-check]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- run: |
make build
make test
docker-image:
name: Publish test docker images for acceptance tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: jack20191124
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image to DockerHub
uses: docker/build-push-action@v3
with:
context: .github/docker/
push: true
tags: jack20191124/packer-plugin-hashistack-acc-test-base:latest
- name: Push image Description
uses: peter-evans/dockerhub-description@v4
with:
username: jack20191124
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: jack20191124/packer-plugin-hashistack-acc-test-base
readme-filepath: .github/docker/README.md
acceptance-tests:
name: Packer Plugin Acceptance Tests
needs: [tests, docker-image]
outputs:
outcome: ${{ job.status }}
continue-on-error: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Install Packer
uses: hashicorp/setup-packer@main
- name: Build plugin
run: go build -ldflags="-X github.com/QubitPi/packer-plugin-hashistack/version.VersionPrerelease=dev" -o packer-plugin-hashistack
- name: Install dependencies
run: |
packer plugins install github.com/hashicorp/amazon
packer plugins install github.com/hashicorp/docker
- name: Install plugin
run: packer plugins install --path packer-plugin-hashistack github.com/QubitPi/hashistack
- name: Run all acceptance tests
run: PACKER_ACC=1 go test -count 1 -v ./... -timeout=120m
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
release:
needs: [acceptance-tests]
if: ${{ github.ref == 'refs/heads/master' && github.repository != 'QubitPi/hashicorp-packer-plugin-scaffolding' }}
uses: ./.github/workflows/release.yml
secrets: inherit
slack-notification:
name: Send Slack Notification
if: github.ref != 'refs/heads/master'
needs: acceptance-tests
uses: QubitPi/hashistack/.github/workflows/slack-notification.yml@master
with:
job-status: ${{ needs.acceptance-tests.outputs.outcome }}
secrets:
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}