Skip to content

Commit

Permalink
Add sops to image (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
snovikov authored Feb 7, 2024
1 parent 30c3a46 commit 5b70e2e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN apk add \
ARG TERRAGRUNT
ARG TERRAFORM
ARG TERRAGRUNT_ATLANTIS_CONFIG
ARG SOPS
ARG ONE_PASSWORD_CLI

###
Expand Down Expand Up @@ -67,6 +68,24 @@ RUN set -eux \
&& chmod +x terragrunt-atlantis-config \
&& rm -rf terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG}_linux_amd64*

###
### Ensure SOPS version is present and validated
###
RUN set -eux \
&& if [ "${SOPS}" = "latest" ]; then \
SOPS="$( \
curl -L -sS --ipv4 https://github.com/getsops/sops/releases \
| tac | tac \
| grep -Eo '"/getsops/sops/releases/tag/v?[0-9]+\.[0-9]+\.[0-9]+"' \
| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' \
| sort -V \
| tail -1 \
)"; \
fi \
&& cd /usr/local/bin \
&& curl -L -sS --ipv4 "https://github.com/getsops/sops/releases/download/v${SOPS}/sops-v${SOPS}.linux.amd64" -o sops \
&& chmod +x sops \
&& sops --version --disable-version-check | grep " ${SOPS}"

###
### Ensure 1Password CLI version is present, linked and validated
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ ATLANTIS = '0.27.1'
TERRAFORM = '1.7.1'
TERRAGRUNT = '0.54.22'
TERRAGRUNT_ATLANTIS_CONFIG = '1.16.0'
SOPS = '3.8.1'
ONE_PASSWORD_CLI = '2.24.0'

pull:
Expand All @@ -26,6 +27,7 @@ build:
--build-arg TERRAFORM=$(TERRAFORM) \
--build-arg TERRAGRUNT=$(TERRAGRUNT) \
--build-arg TERRAGRUNT_ATLANTIS_CONFIG=$(TERRAGRUNT_ATLANTIS_CONFIG) \
--build-arg SOPS=$(SOPS) \
--build-arg ONE_PASSWORD_CLI=$(ONE_PASSWORD_CLI) \
-t $(IMAGE) -f $(DIR)/$(FILE) $(DIR)

Expand All @@ -34,6 +36,7 @@ test:
docker run --rm --entrypoint terraform ${IMAGE} --version | grep -E 'v$(TERRAFORM)$$'
docker run --rm --entrypoint terragrunt ${IMAGE} --version | grep -E 'v$(TERRAGRUNT)$$'
docker run --rm --entrypoint terragrunt-atlantis-config ${IMAGE} version | grep -E "$(TERRAGRUNT_ATLANTIS_CONFIG)$$"
docker run --rm --entrypoint sops ${IMAGE} --version --disable-version-check | grep -E '^sops $(SOPS)$$'
docker run --rm --entrypoint op ${IMAGE} --version | grep -E '$(ONE_PASSWORD_CLI)$$'

tag:
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ For building you can overwrite your desired versions with the following three Ma
* `TERRAFORM`
* `TERRAGRUNT`
* `TERRAGRUNT_ATLANTIS_CONFIG`
* `SOPS`
* `ONE_PASSWORD_CLI`

e.g.
```
make build
make build TERRAFORM=1.7.1
make build TERRAFORM=1.7.1 TERRAGRUNT=0.54.22
make build TERRAFORM=1.7.1 TERRAGRUNT=0.54.22 ATLANTIS=0.27.1
make build TERRAFORM=1.7.1 TERRAGRUNT=0.54.22 ATLANTIS=0.27.1 TERRAGRUNT_ATLANTIS_CONFIG=1.16.0
make build TERRAFORM=1.7.1 TERRAGRUNT=0.54.22 ATLANTIS=0.27.1 TERRAGRUNT_ATLANTIS_CONFIG=1.16.0 ONE_PASSWORD_CLI=2.24.0
make build TERRAFORM=1.7.1 TERRAGRUNT=0.54.22 ATLANTIS=0.27.1 SOPS=3.8.1
```

## Available images
Expand Down

0 comments on commit 5b70e2e

Please sign in to comment.