Skip to content

Commit

Permalink
Merge pull request #13 from BrownUniversity/chore-version-upgrades
Browse files Browse the repository at this point in the history
Chore version upgrades
  • Loading branch information
mirestrepo authored Jul 28, 2022
2 parents 86b839a + 919a476 commit 3ceb2a2
Show file tree
Hide file tree
Showing 14 changed files with 506 additions and 261 deletions.
68 changes: 64 additions & 4 deletions .github/workflows/kitchen-tests.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,72 @@
name: kitchen-tests

on: [push, workflow_dispatch]
on:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'

env:
REGISTRY: ghcr.io
IMAGE_NAME: brownuniversity/terraform-gcp-project

jobs:
all:
if: "!contains(github.event.commits[0].message, '[skip ci]')"
docker:
runs-on: ubuntu-latest
outputs:
full_image_id: ${{ steps.save_full_image_id.outputs.full_image_id }}
steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{major}}.{{minor}}
# NOTE: We are tapping into json output because tags could become a list if prior step is modified
- id: save_full_image_id
run: echo "::set-output name=full_image_id::${{ fromJSON(steps.meta.outputs.json).tags[0] }}"

- name: print_tag
run: echo "${{ fromJSON(steps.meta.outputs.json).tags[0] }}"

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache

kitchen-tests:
needs: docker
runs-on: ubuntu-latest
container: ghcr.io/brownuniversity/kitchen-terraform:1.0.0
container:
image: "${{ needs.docker.outputs.full_image_id }}"

steps:
- uses: actions/checkout@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ override.tf.json
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
examples/simple-project/.terraform.lock.hcl
Brewfile.lock.json
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.74.1 # Get the latest from: https://github.com/antonbabenko/pre-commit-terraform/releases
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.1
3.1.2
2 changes: 1 addition & 1 deletion .terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.2.5
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
terraform 1.2.5
ruby 3.1.2
6 changes: 6 additions & 0 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
brew "pre-commit"
brew "terraform-docs"
brew "tflint"
brew "tfsec"

cask "google-cloud-sdk"
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM hashicorp/terraform:1.2.5

COPY .ruby-version .ruby-version

# Update and install all of the required packages.
# At the end, remove the apk cache
RUN apk upgrade && \
apk add --update \
bash \
curl-dev \
curl \
"ruby-dev=~$(cat .ruby-version)" \
"ruby-full=~$(cat .ruby-version)" \
build-base \
python3 && \
rm -rf /var/cache/apk/*

RUN mkdir /usr/app
WORKDIR /usr/app

COPY Gemfile* ./
RUN gem install bundler && \
bundle config set system 'true' && \
bundle install


ENTRYPOINT ["/bin/bash"]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org/" do
gem "kitchen-terraform", "~> 5.8"
gem "kitchen-terraform", "~> 6.1.0"
end
Loading

0 comments on commit 3ceb2a2

Please sign in to comment.