Skip to content

Commit

Permalink
replace texplate with ytt
Browse files Browse the repository at this point in the history
as texplate is archived and has not been updated since 2018. and currently has some golang lib issues.
darccio/mergo#240
  • Loading branch information
ramonskie committed Jul 3, 2023
1 parent dd66140 commit a081387
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
9 changes: 7 additions & 2 deletions ci/dockerfiles/deployment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,17 @@ RUN curl -s https://api.github.com/repos/cloudfoundry/credhub-cli/releases/lates
mv credhub-* /usr/local/bin/credhub && \
chmod +x /usr/local/bin/credhub

RUN go install github.com/pivotal-cf/texplate@latest

# Install yq
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && \
chmod +x /usr/bin/yq

# Install ytt
RUN curl -s https://api.github.com/repos/carvel-dev/ytt/releases/latest | \
jq -r '.assets[] | .browser_download_url | select(contains("linux-amd64"))' | \
xargs wget && \
mv ytt-* /usr/local/bin/ytt && \
chmod +x /usr/local/bin/ytt

RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && ./aws/install

Expand Down
13 changes: 7 additions & 6 deletions ci/tasks/create-bosh-deployment-source-file/source-template.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
target: {{ env "TARGET" }}
client: {{ env "CLIENT" }}
client_secret: {{ env "CLIENT_SECRET" }}
ca_cert: {{ toJson (env "CA_CERT") }}
jumpbox_url: {{ env "JUMPBOX_URL" }}:22
jumpbox_ssh_key: {{ toJson (env "JUMPBOX_SSH_KEY") }}
#@ load("@ytt:data", "data")
target: #@ data.values.TARGET
client: #@ data.values.CLIENT
client_secret: #@ data.values.CLIENT_SECRET
ca_cert: #@ data.values.CA_CERT
jumpbox_url: #@ data.values.JUMPBOX_URL + ":22"
jumpbox_ssh_key: #@ data.values.JUMPBOX_SSH_KEY
14 changes: 7 additions & 7 deletions ci/tasks/create-bosh-deployment-source-file/task
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ function main() {
source_file="${ROOT}/source-file/bosh-source.json"

pushd "${ROOT}/bbl-states/${BBL_STATE_DIR}" > /dev/null
export TARGET="$(bbl director-address)"
export CLIENT="$(bbl director-username)"
export CLIENT_SECRET="$(bbl director-password)"
export CA_CERT="$(bbl director-ca-cert)"
export JUMPBOX_URL="$(bbl jumpbox-address)"
export JUMPBOX_SSH_KEY="$(bbl ssh-key)"
export YTT_TARGET="$(bbl director-address)"
export YTT_CLIENT="$(bbl director-username)"
export YTT_CLIENT_SECRET="$(bbl director-password)"
export YTT_CA_CERT="$(bbl director-ca-cert)"
export YTT_JUMPBOX_URL="$(bbl jumpbox-address)"
export YTT_JUMPBOX_SSH_KEY="$(bbl ssh-key)"
popd > /dev/null

texplate execute "${ROOT}/bbl-ci/ci/tasks/create-bosh-deployment-source-file/source-template.yml" -o json > "${source_file}"
ytt -f "${ROOT}/bbl-ci/ci/tasks/create-bosh-deployment-source-file/source-template.yml" --data-values-env YTT > "${source_file}"
}

main
10 changes: 7 additions & 3 deletions dockerfiles/cf-deployment-concourse-tasks-bbl-dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM cloudfoundry/cf-deployment-concourse-tasks
MAINTAINER https://github.com/cloudfoundry/bosh-bootloader
LABEL maintainer="https://github.com/cloudfoundry/bosh-bootloader"

# Create directory for GOPATH
RUN mkdir -p /go/bin
Expand All @@ -26,8 +26,12 @@ RUN echo "deb https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /et
apt-get update && \
apt-get -qqy install google-cloud-cli

# needed in the task 'create-bosh-source-file'
RUN go install github.com/pivotal-cf/texplate@latest
# Install ytt
RUN curl -s https://api.github.com/repos/carvel-dev/ytt/releases/latest | \
jq -r '.assets[] | .browser_download_url | select(contains("linux-amd64"))' | \
xargs wget && \
mv ytt-* /usr/local/bin/ytt && \
chmod +x /usr/local/bin/ytt

# add bbl from latest commit
ADD bbl /usr/local/bin/
Expand Down

0 comments on commit a081387

Please sign in to comment.