Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/asottile/dockerfile" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestParsing(t *testing.T) { | ||
expected := []Image{ | ||
{Name: "golang", Tag: "1.17.0-alpine"}, | ||
{Name: "common", Tag: "?"}, | ||
{Name: "common", Tag: "?"}, | ||
{Name: "common", Tag: "?"}, | ||
{Name: "viaductoss/ksops", Tag: "v3.0.0"}, | ||
{Name: "quay.io/argoproj/argocd", Tag: "$ARGOCD_VERSION"}, | ||
} | ||
|
||
commands, err := dockerfile.ParseFile("tests/Dockerfile.1") | ||
|
||
if err != nil { | ||
t.Errorf("Could not open Dockerfile.1: %s", err) | ||
} | ||
|
||
tags := getTags(commands) | ||
|
||
assert.Equal(t, expected, tags) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
ARG ARGOCD_VERSION | ||
|
||
FROM golang:1.17.0-alpine AS common | ||
|
||
LABEL go.version="1.17.0" | ||
|
||
RUN apk add -q --no-cache git=2.32.0-r0 musl-dev=1.2.2-r3 gcc=10.3.1_git20210424-r2 | ||
|
||
FROM common AS jb-builder | ||
|
||
ARG JSONNET_BUNDLER_COMMIT | ||
|
||
WORKDIR /jsonnet-bundler | ||
|
||
RUN git init --quiet && \ | ||
git remote add origin https://github.com/jsonnet-bundler/jsonnet-bundler.git && \ | ||
git fetch -n --depth 1 origin $JSONNET_BUNDLER_COMMIT && \ | ||
git reset --hard FETCH_HEAD && \ | ||
go build -ldflags='-extldflags=-static -linkmode=external' -o jb /jsonnet-bundler/cmd/jb | ||
|
||
FROM common AS go-jsonnet-builder | ||
|
||
ARG GOJSONNET_VERSION | ||
|
||
RUN go install -ldflags='-extldflags=-static -linkmode=external' github.com/google/go-jsonnet/cmd/jsonnet@$GOJSONNET_VERSION | ||
|
||
FROM common AS go-jsontoyaml-builder | ||
|
||
ARG GOJSONTOYAML_VERSION | ||
|
||
RUN go install -ldflags='-extldflags=-static -linkmode=external' github.com/brancz/gojsontoyaml@$GOJSONTOYAML_VERSION | ||
|
||
FROM viaductoss/ksops:v3.0.0 AS ksops-builder | ||
|
||
LABEL tools.ksops.version="v3.0.0" | ||
|
||
FROM quay.io/argoproj/argocd:$ARGOCD_VERSION | ||
|
||
ARG HELM_SECRETS_VERSION | ||
|
||
# Switch to root for the ability to perform install | ||
USER root | ||
|
||
# Set the kustomize home directory | ||
ENV XDG_CONFIG_HOME=$HOME/.config | ||
ENV KUSTOMIZE_PLUGIN_PATH=$XDG_CONFIG_HOME/kustomize/plugin/ | ||
|
||
ARG PKG_NAME=ksops | ||
|
||
COPY --from=jb-builder /jsonnet-bundler/jb /usr/local/bin/jb | ||
|
||
COPY --from=go-jsonnet-builder /go/bin/jsonnet /usr/local/bin/jsonnet | ||
|
||
COPY --from=go-jsontoyaml-builder /go/bin/gojsontoyaml /usr/local/bin/gojsontoyaml | ||
|
||
# Override the default kustomize executable with the Go built version | ||
COPY --from=ksops-builder /go/bin/kustomize /usr/local/bin/kustomize | ||
|
||
# Switch back to non-root user | ||
USER 999 | ||
|
||
# Copy the plugin to kustomize plugin path | ||
COPY --from=ksops-builder /go/src/github.com/viaduct-ai/kustomize-sops/* $KUSTOMIZE_PLUGIN_PATH/viaduct.ai/v1/${PKG_NAME}/ | ||
|
||
ENV HELM_SECRETS_SOPS_PATH=$KUSTOMIZE_PLUGIN_PATH/viaduct.ai/v1/${PKG_NAME}/sops | ||
|
||
RUN helm plugin install https://github.com/jkroepke/helm-secrets --version $HELM_SECRETS_VERSION |