Skip to content

Commit

Permalink
Merge 21a0374 into efdac1a
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentLesle authored Oct 1, 2020
2 parents efdac1a + 21a0374 commit b2bc864
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 239 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
"dockerComposeFile": "docker-compose.yml",

// Container user to use in VSCode Online and GitHub Codespaces
"containerUser" : "vscode",

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "rover",
Expand Down
10 changes: 5 additions & 5 deletions .env
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
versionTerraform=0.13.0
versionAzureCli=2.9.1
versionTerraform=0.13.3
versionAzureCli=2.12.1
versionKubectl=v1.18.6
versionGit=2.27.0
versionTflint=v0.18.0
versionJq=1.6
versionDockerCompose=1.25.5
versionAzureCafTerraform=v.0.3.1
versionTfsec=v0.24.1
versionTerraformDocs=v0.9.1
versionTfsec=v0.27.0
versionTerraformDocs=v0.10.1
versionAnsible=2.10
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
39 changes: 8 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ FROM golang:1.13 as terraform-docs
ARG versionTerraformDocs
ENV versionTerraformDocs=${versionTerraformDocs}

RUN GO111MODULE="on" go get github.com/segmentio/terraform-docs@${versionTerraformDocs}
RUN GO111MODULE="on" go get github.com/terraform-docs/terraform-docs@${versionTerraformDocs}

###########################################################
# Getting latest version of tfsec
Expand All @@ -50,34 +50,6 @@ FROM golang:1.13 as tfsec
# to force the docker cache to invalidate when there is a new version
RUN env GO111MODULE=on go get -u github.com/liamg/tfsec/cmd/tfsec

###########################################################
# Getting latest version of Azure CAF Terraform provider
###########################################################
FROM golang:1.13 as azurecaf

ARG versionAzureCafTerraform
ENV versionAzureCafTerraform=${versionAzureCafTerraform}

# to force the docker cache to invalidate when there is a new version
ADD https://api.github.com/repos/aztfmod/terraform-provider-azurecaf/git/ref/tags/${versionAzureCafTerraform} version.json
RUN cd /tmp && \
git clone https://github.com/aztfmod/terraform-provider-azurecaf.git && \
cd terraform-provider-azurecaf && \
go build -o terraform-provider-azurecaf

###########################################################
# Getting latest version of yaegashi/terraform-provider-msgraph
###########################################################
FROM golang:1.13 as msgraph

# to force the docker cache to invalidate when there is a new version
ADD https://api.github.com/repos/aztfmod/terraform-provider-azurecaf/git/ref/heads/master version.json
RUN cd /tmp && \
git clone https://github.com/yaegashi/terraform-provider-msgraph.git && \
cd terraform-provider-msgraph && \
go build -o terraform-provider-msgraph



###########################################################
# CAF rover image
Expand All @@ -93,6 +65,7 @@ ARG versionGit
ARG versionJq
ARG versionDockerCompose
ARG versionTfsec
ARG versionAnsible

ARG USERNAME=vscode
ARG USER_UID=1000
Expand All @@ -109,6 +82,7 @@ ENV SSH_PASSWD=${SSH_PASSWD} \
versionGit=${versionGit} \
versionDockerCompose=${versionDockerCompose} \
versionTfsec=${versionTfsec} \
versionAnsible=${versionAnsible} \
TF_DATA_DIR="/home/${USERNAME}/.terraform.cache" \
TF_PLUGIN_CACHE_DIR="/home/${USERNAME}/.terraform.cache/plugin-cache"

Expand Down Expand Up @@ -185,6 +159,11 @@ gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azu
echo "Installing pre-commit ..." && \
python3 -m pip install pre-commit && \
#
# Install Ansible
#
echo "Installing Ansible ..." && \
pip3 install --user https://github.com/ansible/ansible/archive/stable-${versionAnsible}.tar.gz && \
#
# Install tflint
#
echo "Installing tflint ..." && \
Expand Down Expand Up @@ -215,8 +194,6 @@ COPY ./scripts/sshd_config /home/${USERNAME}/.ssh/sshd_config


# Add Community terraform providers
COPY --from=azurecaf /tmp/terraform-provider-azurecaf/terraform-provider-azurecaf /bin/
COPY --from=msgraph /tmp/terraform-provider-msgraph/terraform-provider-msgraph /bin/
COPY --from=tfsec /go/bin/tfsec /bin/
COPY --from=terraform-docs /go/bin/terraform-docs /bin/

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ local:

dev:
@bash "$(CURDIR)/scripts/build_image.sh" "dev"

alpha:
@bash "$(CURDIR)/scripts/build_image.sh" "alpha"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
![](https://github.com/aztfmod/rover/workflows/master/badge.svg)
![](https://github.com/aztfmod/rover/workflows/.github/workflows/ci-branches.yml/badge.svg)
[![VScodespaces](https://img.shields.io/endpoint?url=https%3A%2F%2Faka.ms%2Fvso-badge)](https://online.visualstudio.com/environments/new?name=rover=aztfmod/rover)
[![Gitter](https://badges.gitter.im/aztfmod/community.svg)](https://gitter.im/aztfmod/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

## Introduction

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ services:
- versionTflint
- versionJq
- versionDockerCompose
- versionAzureCafTerraform
- versionRover
- versionTfsec
- versionTerraformDocs
- versionAnsible

volumes:
- ..:/tf
Expand Down
29 changes: 12 additions & 17 deletions scripts/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ case "$1" in
tag=$(date +"%g%m.%d%H")
rover="aztfmod/rover:${tag}"
;;
"alpha")
tag=$(date +"%g%m.%d%H%M")
rover="aztfmod/roveralpha:${tag}"
;;
"dev")
tag=$(date +"%g%m.%d%H%M")
rover="aztfmod/roverdev:${tag}"
;;
*)
"local")
tag=$(date +"%g%m.%d%H%M")
rover="aztfmod/rover:${tag}"
rover="roverlocal:${tag}"
;;
esac

Expand All @@ -28,29 +32,20 @@ sudo docker-compose build --build-arg versionRover=${rover}
case "$1" in
"github")
sudo docker tag rover_rover ${rover}
sudo docker tag rover_rover aztfmod/rover:latest

sudo docker push ${rover}
sudo docker push aztfmod/rover:latest

# tag the git branch and push
git tag ${tag} master
git push --follow-tags
echo "Version aztfmod/rover:${tag} created."
;;
"dev")
"local")
sudo docker tag rover_rover ${rover}
sudo docker tag rover_rover aztfmod/roverdev:latest

sudo docker push ${rover}
sudo docker push aztfmod/roverdev:latest
echo "Version aztfmod/roverdev:${tag} created."
echo "Version aztfmod/roverdev:latest created."
echo "Version ${rover} created."
;;
*)
sudo docker tag rover_rover aztfmod/rover:$tag
sudo docker tag rover_rover aztfmod/rover:latest
echo "Local version created"
echo "Version aztfmod/rover:${tag} created."
*)
sudo docker tag rover_rover ${rover}
sudo docker push ${rover}
echo "Version ${rover} created."
;;
esac
Loading

0 comments on commit b2bc864

Please sign in to comment.