Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLT-0 - Add one password cli #97

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 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 ONE_PASSWORD_CLI

###
### Ensure Terraform version is present, linked and validated
Expand Down Expand Up @@ -66,4 +67,26 @@ RUN set -eux \
&& chmod +x terragrunt-atlantis-config \
&& rm -rf terragrunt-atlantis-config_${TERRAGRUNT_ATLANTIS_CONFIG}_linux_amd64*


###
### Ensure 1Password CLI version is present, linked and validated
###
RUN set -eux \
&& if [ "${ONE_PASSWORD_CLI}" = "latest" ]; then \
ONE_PASSWORD_CLI="$( \
curl -sS https://app-updates.agilebits.com/product_history/CLI2 \
| grep -Eo '"/dist/1P/op2/pkg/v?[0-9]+\.[0-9]+\.[0-9]+/op_linux_amd64"' \
| grep -Eo '[0-9]+\.[0-9]+\.[0-9]+' \
| sort -V \
| tail -1 \
)"; \
fi \
&& cd "/tmp" \
&& curl -sS "https://cache.agilebits.com/dist/1P/op2/pkg/v${ONE_PASSWORD_CLI}/op_linux_amd64_v${ONE_PASSWORD_CLI}.zip" -o op.zip \
&& unzip op.zip \
&& rm op.zip \
&& chmod +x op \
&& mv op /usr/local/bin/op \
&& op --version | grep "${ONE_PASSWORD_CLI}"

USER atlantis
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.0'
TERRAFORM = '1.6.6'
TERRAGRUNT = '0.54.4'
TERRAGRUNT_ATLANTIS_CONFIG = '1.16.0'
ONE_PASSWORD_CLI = '2.24.0'

pull:
docker pull $(shell grep FROM Dockerfile | sed 's/^FROM//g' | sed "s/\$${ATLANTIS}/$(ATLANTIS)/g";)
Expand All @@ -25,13 +26,15 @@ build:
--build-arg TERRAFORM=$(TERRAFORM) \
--build-arg TERRAGRUNT=$(TERRAGRUNT) \
--build-arg TERRAGRUNT_ATLANTIS_CONFIG=$(TERRAGRUNT_ATLANTIS_CONFIG) \
--build-arg ONE_PASSWORD_CLI=$(ONE_PASSWORD_CLI) \
-t $(IMAGE) -f $(DIR)/$(FILE) $(DIR)

test:
docker run --rm --entrypoint atlantis ${IMAGE} version | grep -E '^atlantis v$(ATLANTIS) '
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 op ${IMAGE} --version | grep -E '$(ONE_PASSWORD_CLI)$$'

tag:
docker tag $(IMAGE) $(IMAGE):$(TAG)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ For building you can overwrite your desired versions with the following three Ma
* `TERRAFORM`
* `TERRAGRUNT`
* `TERRAGRUNT_ATLANTIS_CONFIG`
* `ONE_PASSWORD_CLI`

```
make build
make build TERRAFORM=1.6.6
make build TERRAFORM=1.6.6 TERRAGRUNT=0.54.4
make build TERRAFORM=1.6.6 TERRAGRUNT=0.54.4 ATLANTIS=0.27.0
make build TERRAFORM=1.6.6 TERRAGRUNT=0.54.4 ATLANTIS=0.27.0 TERRAGRUNT_ATLANTIS_CONFIG=1.16.0
make build TERRAFORM=1.6.6 TERRAGRUNT=0.54.4 ATLANTIS=0.27.0 TERRAGRUNT_ATLANTIS_CONFIG=1.16.0 ONE_PASSWORD_CLI=2.24.0
```

## Available images
Expand Down