Skip to content

Commit

Permalink
build: fix build terraform/opentofu build pathing (#4439)
Browse files Browse the repository at this point in the history
Co-authored-by: PePe Amengual <jose.amengual@gmail.com>
  • Loading branch information
dylanhitt and jamengual committed Apr 19, 2024
1 parent d825d58 commit cc994a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ RUN addgroup atlantis && \
# copy atlantis binary
COPY --from=builder /app/atlantis /usr/local/bin/atlantis
# copy terraform binaries
COPY --from=deps /usr/local/bin/terraform* /usr/local/bin/
COPY --from=deps /usr/local/bin/tofu* /usr/local/bin/
COPY --from=deps /usr/local/bin/terraform/terraform* /usr/local/bin/
COPY --from=deps /usr/local/bin/tofu/tofu* /usr/local/bin/
# copy dependencies
COPY --from=deps /usr/local/bin/conftest /usr/local/bin/conftest
COPY --from=deps /usr/bin/git-lfs /usr/bin/git-lfs
Expand Down Expand Up @@ -187,8 +187,8 @@ RUN useradd --create-home --user-group --shell /bin/bash atlantis && \
# copy atlantis binary
COPY --from=builder /app/atlantis /usr/local/bin/atlantis
# copy terraform binaries
COPY --from=deps /usr/local/bin/terraform* /usr/local/bin/
COPY --from=deps /usr/local/bin/tofu* /usr/local/bin/
COPY --from=deps /usr/local/bin/terraform/terraform* /usr/local/bin/
COPY --from=deps /usr/local/bin/tofu/tofu* /usr/local/bin/
# copy dependencies
COPY --from=deps /usr/local/bin/conftest /usr/local/bin/conftest
COPY --from=deps /usr/bin/git-lfs /usr/bin/git-lfs
Expand Down
12 changes: 6 additions & 6 deletions scripts/download-release.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
COMMAND_NAME=${1:-terraform}
TARGETPLATFORM=${2:-"linux/amd64"}
DEFAULT_VERSION=${3:-"1.6.2"}
AVAILABLE_VERSIONS=${4:-"1.6.2"}
DEFAULT_VERSION=${3:-"1.8.0"}
AVAILABLE_VERSIONS=${4:-"1.8.0"}
case "${TARGETPLATFORM}" in
"linux/amd64") ARCH=amd64 ;;
"linux/arm64") ARCH=arm64 ;;
Expand All @@ -13,11 +13,11 @@ for VERSION in ${AVAILABLE_VERSIONS}; do
case "${COMMAND_NAME}" in
"terraform")
DOWNLOAD_URL_FORMAT=$(printf 'https://releases.hashicorp.com/terraform/%s/%s_%s' "$VERSION" "$COMMAND_NAME" "$VERSION")
COMMAND_DIR=/usr/local/bin/tf
COMMAND_DIR=/usr/local/bin/terraform
;;
"tofu")
DOWNLOAD_URL_FORMAT=$(printf 'https://github.com/opentofu/opentofu/releases/download/v%s/%s_%s' "$VERSION" "$COMMAND_NAME" "$VERSION")
COMMAND_DIR=/usr/local/bin/opentofu
COMMAND_DIR=/usr/local/bin/tofu
;;
*) echo "ERROR: 'COMMAND_NAME' value unexpected: ${COMMAND_NAME}"; exit 1 ;;
esac
Expand All @@ -26,8 +26,8 @@ for VERSION in ${AVAILABLE_VERSIONS}; do
sed -n "/${COMMAND_NAME}_${VERSION}_linux_${ARCH}.zip/p" "${COMMAND_NAME}_${VERSION}_SHA256SUMS" | sha256sum -c
mkdir -p "${COMMAND_DIR}/${VERSION}"
unzip "${COMMAND_NAME}_${VERSION}_linux_${ARCH}.zip" -d "${COMMAND_DIR}/${VERSION}"
ln -s "${COMMAND_DIR}/${VERSION}/${COMMAND_NAME}" "${COMMAND_NAME}${VERSION}"
ln -s "${COMMAND_DIR}/${VERSION}/${COMMAND_NAME}" "${COMMAND_DIR}/${COMMAND_NAME}${VERSION}"
rm "${COMMAND_NAME}_${VERSION}_linux_${ARCH}.zip"
rm "${COMMAND_NAME}_${VERSION}_SHA256SUMS"
done
ln -s "${COMMAND_DIR}/${DEFAULT_VERSION}/${COMMAND_NAME}" "${COMMAND_NAME}"
ln -s "${COMMAND_DIR}/${DEFAULT_VERSION}/${COMMAND_NAME}" "${COMMAND_DIR}/${COMMAND_NAME}"

0 comments on commit cc994a3

Please sign in to comment.