Skip to content

Commit 39ff057

Browse files
dandimeodandimeonerpaula
authored
[DOC-604] Download always latest oasisctl tag in Dockerfile (#288)
* use curl to retrieve latest oasisctl tag and download it in dockerfile * oasisctl setup in toolchain script * no oasisctl download in dockerfile * check if oasisctl.zip exists before downloading oasisctl * move log inside if --------- Co-authored-by: dandimeo <[email protected]> Co-authored-by: Paula Mihu <[email protected]>
1 parent f8153fe commit 39ff057

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

toolchain/docker/Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ ENV ARCH=${BUILDARCH}
4646
RUN apk add --update --no-cache unzip curl jq docker-cli bash python3 py3-pip
4747

4848
RUN wget -q https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$ARCH -O /usr/bin/yq && chmod +x /usr/bin/yq
49-
RUN wget https://github.com/arangodb-managed/oasisctl/releases/download/v1.19.0/oasisctl.zip && unzip oasisctl.zip
50-
RUN mv bin/linux/arm/ bin/linux/arm64
51-
RUN cd bin/linux/$ARCH && mv oasisctl /usr/bin/oasisctl && chmod +x /usr/bin/oasisctl
5249

5350
RUN pip3 install pyyaml
5451

toolchain/scripts/toolchain.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ function generate_oasisctl() {
522522
523523
log "[generate_oasisctl] Generate OasisCTL docs"
524524
525+
if [ ! -f /tmp/oasisctl.zip ]; then
526+
log "[generate_oasisctl] /tmp/oasisctl.zip not found. Invoking download_oasisctl"
527+
download_oasisctl
528+
fi
525529
526530
mkdir -p /tmp/oasisctl
527531
mkdir -p /tmp/preserve
@@ -551,6 +555,17 @@ function generate_oasisctl() {
551555
log "[generate_oasisctl] Done"
552556
}
553557
558+
function download_oasisctl() {
559+
oasisctlVersion=$(curl -I https://github.com/arangodb-managed/oasisctl/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}')
560+
log "[download_oasisctl] Downloading oasisctl version $oasisctlVersion"
561+
cd /tmp
562+
wget https://github.com/arangodb-managed/oasisctl/releases/download/$oasisctlVersion/oasisctl.zip
563+
unzip oasisctl.zip
564+
mv bin/linux/arm/ bin/linux/arm64
565+
mv bin/linux/amd64/oasisctl /usr/bin/oasisctl && chmod +x /usr/bin/oasisctl
566+
cd /home/toolchain/scripts
567+
}
568+
554569
555570
556571
### SYSTEM HANDLERS FUNCTIONS

0 commit comments

Comments
 (0)