From c1d45df529f15325d110a0c2257183aa98512ae1 Mon Sep 17 00:00:00 2001 From: Vedran Pugar <72854396+vpugar-digital@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:26:04 +0100 Subject: [PATCH] S-96287 Detached installation of the Release and RRR (#217) Co-authored-by: Vedran Pugar --- applejack/conf/products/xl-client.yml | 1 - templates/dockerfiles/xl-cli/Dockerfile.j2 | 51 +++++++++++++--------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/applejack/conf/products/xl-client.yml b/applejack/conf/products/xl-client.yml index ec979250c..399af5af3 100644 --- a/applejack/conf/products/xl-client.yml +++ b/applejack/conf/products/xl-client.yml @@ -5,7 +5,6 @@ dockerfiles: alpine: xl-cli/Dockerfile.j2 repositories: nexus: 'https://nexus.xebialabs.com/nexus/service/local/repositories/{repo}/content/com/xebialabs/xlclient/xl-client/{version}/{product}-{version}-linux-amd64.bin' - # Todo proper DIST URL dist: 'https://dist.xebialabs.com/public/xl-cli/{version}/linux-amd64/xl' resources: target_name: '{product}-{version}-linux-amd64.bin' diff --git a/templates/dockerfiles/xl-cli/Dockerfile.j2 b/templates/dockerfiles/xl-cli/Dockerfile.j2 index 4a5249f22..e3d1f515c 100644 --- a/templates/dockerfiles/xl-cli/Dockerfile.j2 +++ b/templates/dockerfiles/xl-cli/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM alpine:3.16 as installer +FROM alpine:3.19 as installer # Install dependencies RUN apk update @@ -6,6 +6,7 @@ RUN apk add --no-cache gawk unzip curl busybox-extras ENV USER_UID=10001 APP_ROOT=/opt/xebialabs ENV APP_HOME=${APP_ROOT}/{{ product }} +ENV XL_OP_BLUEPRINTS_HOME=${APP_ROOT}/xl-op-blueprints COPY resources/{{ product }}-{{ xl_version }}-linux-amd64.bin /tmp @@ -15,7 +16,13 @@ RUN mkdir -p ${APP_HOME} && \ chmod -R g=u ${APP_ROOT} && \ chmod +x ${APP_HOME}/xl -FROM alpine:3.16 +RUN mkdir -p ${XL_OP_BLUEPRINTS_HOME} && \ + wget -O /tmp/xl-op-blueprints-{{ xl_version }}.zip https://nexus.xebialabs.com/nexus/content/repositories/digitalai-public/ai/digital/xlclient/blueprints/xl-op-blueprints/{{ xl_version }}/xl-op-blueprints-{{ xl_version }}.zip && \ + unzip -o /tmp/xl-op-blueprints-{{ xl_version }}.zip -d ${XL_OP_BLUEPRINTS_HOME} && \ + chgrp -R 0 ${XL_OP_BLUEPRINTS_HOME} && \ + chmod -R g=u ${XL_OP_BLUEPRINTS_HOME} + +FROM alpine:3.19 {% include 'metadata.j2' %} @@ -53,6 +60,8 @@ RUN apk add --no-cache curl tar && \ # Install vim RUN apk add --no-cache vim xclip +{% if xl_version.endswith('-all') %} + # Install oc RUN apk add --no-cache gcompat curl ca-certificates tar gzip && \ curl -L https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.8.11/openshift-client-linux.tar.gz | tar zx && \ @@ -83,6 +92,24 @@ RUN apk update && \ RUN pip3 install awscli RUN aws --version +# Set up gcloud config, aws config +RUN mkdir -p ${APP_ROOT}/.config/gcloud && \ + mkdir -p ${APP_ROOT}/.aws + +# Install Krew +RUN cd /tmp \ + && wget -O krew-linux_amd64.tar.gz https://github.com/kubernetes-sigs/krew/releases/download/v0.4.3/krew-linux_amd64.tar.gz \ + && tar zxvf krew-linux_amd64.tar.gz \ + && ./krew-linux_amd64 install krew && \ + rm -rf /tmp/krew* + +# Set up Krew +ENV PATH="${APP_ROOT}/.krew/bin:${PATH}" + +RUN kubectl krew install oidc-login + +{% endif %} + # Add user RUN apk add --no-cache shadow && \ useradd -d /opt/xebialabs -m -r -u 10001 -g 0 xebialabs @@ -90,12 +117,8 @@ RUN apk add --no-cache shadow && \ # Copy installed {{ product_name }} COPY --from=installer ${APP_ROOT} ${APP_ROOT} -# Set up gcloud config, aws config and kube config folder -RUN mkdir -p ${APP_ROOT}/.config/gcloud && \ - mkdir -p ${APP_ROOT}/.kube && \ - mkdir -p ${APP_ROOT}/.aws - -ENV KUBECONFIG=${APP_ROOT}/.kube/config +# Set up kube config folder +RUN mkdir -p ${APP_ROOT}/.kube # Install Tini ADD https://github.com/krallin/tini/releases/download/v0.19.0/tini-static ${APP_ROOT}/tini @@ -107,16 +130,4 @@ WORKDIR ${APP_HOME} # Don't run as root USER 10001 -# Install Krew -RUN cd /tmp \ - && wget -O krew-linux_amd64.tar.gz https://github.com/kubernetes-sigs/krew/releases/download/v0.4.3/krew-linux_amd64.tar.gz \ - && tar zxvf krew-linux_amd64.tar.gz \ - && ./krew-linux_amd64 install krew && \ - rm -rf /tmp/krew* - -# Set up Krew -ENV PATH="${APP_ROOT}/.krew/bin:${PATH}" - -RUN kubectl krew install oidc-login - ENTRYPOINT ["/opt/xebialabs/tini", "--", "/opt/xebialabs/xl-client/xl"]