Skip to content

Commit

Permalink
CR-16346 - support creating runtime+agent only in platform (#833)
Browse files Browse the repository at this point in the history
## What
added options to enable runtime+agent creation on platform only, without
any changes to the cluster

## Why
will be called during a helm installation. the cluster changes will be
managed by helm

## Notes
  • Loading branch information
ATGardner authored Aug 27, 2023
1 parent 2c58bd8 commit d44451c
Show file tree
Hide file tree
Showing 10 changed files with 605 additions and 429 deletions.
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,26 @@ ENV PATH="/pyinstaller:$PATH"
RUN pip install yq==${YQ_VERSION}
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)

# kubectl binary
FROM bitnami/kubectl:1.27.4 as kubectl

# Main
FROM node:18.17.1-alpine3.17
FROM node:18.17.1-alpine3.18

RUN apk --update add --no-cache ca-certificates git curl bash jq
RUN apk --update add --no-cache \
bash \
ca-certificates \
curl \
git \
jq

COPY --from=go /go/bin/hub /usr/local/bin/hub
COPY --from=yq /tmp/yq /usr/local/bin/yq
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/

WORKDIR /cf-cli

COPY package.json /cf-cli
COPY yarn.lock /cf-cli
COPY check-version.js /cf-cli
COPY run-check-version.js /cf-cli
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/

RUN yarn install --prod --frozen-lockfile && \
yarn cache clean
Expand Down
21 changes: 15 additions & 6 deletions Dockerfile-debian
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,30 @@ ENV PATH="/pyinstaller:$PATH"
RUN pip install yq==${YQ_VERSION}
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)

# kubectl binary
FROM bitnami/kubectl:1.27.4 as kubectl

# Main
FROM node:18.17.1-bullseye-slim

RUN apt update
RUN apt -y install ca-certificates git curl bash jq busybox && ln -s /bin/busybox /usr/bin/[[
RUN apt update \
&& apt -y install \
apt-transport-https \
bash \
busybox \
ca-certificates \
curl \
git \
jq \
&& ln -s /bin/busybox /usr/bin/[[

COPY --from=go /go/bin/hub /usr/local/bin/hub
COPY --from=yq /tmp/yq /usr/local/bin/yq
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/

WORKDIR /cf-cli

COPY package.json /cf-cli
COPY yarn.lock /cf-cli
COPY check-version.js /cf-cli
COPY run-check-version.js /cf-cli
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/

RUN yarn install --prod --frozen-lockfile && \
yarn cache clean
Expand Down
22 changes: 15 additions & 7 deletions Dockerfile-debian-rootless
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,29 @@ ENV PATH="/pyinstaller:$PATH"
RUN pip install yq==${YQ_VERSION}
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)

# kubectl binary
FROM bitnami/kubectl:1.27.4 as kubectl

# Main
FROM node:18.17.1-bullseye-slim

RUN apt update
RUN apt -y install ca-certificates git curl bash jq busybox && ln -s /bin/busybox /usr/bin/[[
RUN apt update \
&& apt -y install \
bash \
busybox \
ca-certificates \
curl \
git \
jq \
&& ln -s /bin/busybox /usr/bin/[[

COPY --from=go /go/bin/hub /usr/local/bin/hub
COPY --from=yq /tmp/yq /usr/local/bin/yq
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/

WORKDIR /cf-cli

COPY package.json /cf-cli
COPY yarn.lock /cf-cli
COPY check-version.js /cf-cli
COPY run-check-version.js /cf-cli
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/

RUN yarn install --prod --frozen-lockfile && \
yarn cache clean
Expand All @@ -38,7 +46,7 @@ RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
RUN codefresh components update --location components

# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
# and we do not want to break user automation if he used to bind his .cfconfig
# and we do not want to break user automation if they used to bind their .cfconfig
# to the /root/.cfconfig
RUN useradd -m -d /root -s /bin/sh cfu \
&& chown -R $(id -g cfu) /root /cf-cli \
Expand Down
20 changes: 13 additions & 7 deletions Dockerfile-rootless
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,26 @@ ENV PATH="/pyinstaller:$PATH"
RUN pip install yq==${YQ_VERSION}
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)

# kubectl binary
FROM bitnami/kubectl:1.27.4 as kubectl

# Main
FROM node:18.17.1-alpine3.17
FROM node:18.17.1-alpine3.18

RUN apk --update add --no-cache ca-certificates git curl bash jq
RUN apk --update add --no-cache \
bash \
ca-certificates \
curl \
git \
jq

COPY --from=go /go/bin/hub /usr/local/bin/hub
COPY --from=yq /tmp/yq /usr/local/bin/yq
COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/

WORKDIR /cf-cli

COPY package.json /cf-cli
COPY yarn.lock /cf-cli
COPY check-version.js /cf-cli
COPY run-check-version.js /cf-cli
COPY package.json yarn.lock check-version.js run-check-version.js /cf-cli/

RUN yarn install --prod --frozen-lockfile && \
yarn cache clean
Expand All @@ -37,7 +43,7 @@ RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
RUN codefresh components update --location components

# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
# and we do not want to break user automation if he used to bind his .cfconfig
# and we do not want to break user automation if they used to bind their .cfconfig
# to the /root/.cfconfig
RUN adduser -D -h /root -s /bin/sh cfu \
&& chown -R $(id -g cfu) /root /cf-cli \
Expand Down
24 changes: 16 additions & 8 deletions codefresh-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ steps:
disable_push: true
dockerfile: ./Dockerfile
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}
tag: ${{CF_BRANCH_TAG_NORMALIZED}}

build_image_debian:
title: "Building the debian image..."
Expand All @@ -35,7 +35,7 @@ steps:
disable_push: true
dockerfile: ./Dockerfile-debian
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}

build_image_alpine_rootless:
title: "Building the alpine image..."
Expand All @@ -44,7 +44,7 @@ steps:
disable_push: true
dockerfile: ./Dockerfile-rootless
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}${{ROOTLESS_TAG_POSTFIX}}
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}

build_image_debian_rootless:
title: "Building the debian image..."
Expand All @@ -53,7 +53,7 @@ steps:
disable_push: true
dockerfile: ./Dockerfile-debian-rootless
image_name: ${{IMAGE_NAME}}
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
when:
steps:
- name: main_clone
Expand All @@ -65,7 +65,9 @@ steps:
type: push
candidate: ${{build_image_alpine}}
title: "Pushing alpine image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{ARM_TAG_POSTFIX}}
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ARM_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ARM_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
scale:
push_quay_dev:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
Expand All @@ -87,7 +89,9 @@ steps:
type: push
candidate: ${{build_image_debian}}
title: "Pushing debian image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
scale:
push_quay_dev_debian:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
Expand All @@ -109,7 +113,9 @@ steps:
type: push
candidate: ${{build_image_alpine_rootless}}
title: "Pushing rootless alpine image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
scale:
push_quay_dev_rootless:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
Expand All @@ -131,7 +137,9 @@ steps:
type: push
candidate: ${{build_image_debian_rootless}}
title: "Pushing rootless debian image to registry with revision tag"
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
scale:
push_quay_dev_debian_rootless:
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
Expand Down
30 changes: 21 additions & 9 deletions codefresh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,24 +111,28 @@ steps:
type: build
dockerfile: Dockerfile
image-name: codefresh/cli
disable_push: true
tag: ${{CF_BRANCH_TAG_NORMALIZED}}

build_step_debian:
type: build
dockerfile: Dockerfile-debian
image-name: codefresh/cli
disable_push: true
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}

build_step_alpine_rootless:
type: build
dockerfile: Dockerfile-rootless
image-name: codefresh/cli
disable_push: true
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}

build_step_debian_rootless:
type: build
dockerfile: Dockerfile-debian-rootless
image-name: codefresh/cli
disable_push: true
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
when:
steps:
Expand Down Expand Up @@ -166,7 +170,9 @@ steps:
push_step_alpine:
stage: push
type: push
tag: '${{CF_SHORT_REVISION}}'
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}
- ${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}
candidate: ${{build_step_alpine}}
scale:
push_to_dockerhub:
Expand All @@ -186,7 +192,9 @@ steps:
push_step_debian:
stage: push
type: push
tag: '${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}'
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
candidate: ${{build_step_debian}}
scale:
push_to_dockerhub_debian:
Expand All @@ -206,7 +214,9 @@ steps:
push_step_alpine_rootless:
stage: push
type: push
tag: '${{CF_SHORT_REVISION}}${{ROOTLESS_TAG_POSTFIX}}'
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
candidate: ${{build_step_alpine_rootless}}
scale:
push_to_dockerhub_rootless:
Expand All @@ -226,7 +236,9 @@ steps:
push_step_debian_rootless:
stage: push
type: push
tag: '${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}'
tags:
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}-${{CF_SHORT_REVISION}}
candidate: ${{build_step_debian_rootless}}
scale:
push_to_dockerhub_debian_rootless:
Expand Down Expand Up @@ -268,28 +280,28 @@ steps:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}
- ${{CF_BRANCH_TAG_NORMALIZED}}
dev_branches_tags_debian:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}
dev_branches_tags_rootless:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}${{ROOTLESS_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{ROOTLESS_TAG_POSTFIX}}
dev_branches_tags_debian_rootless:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
- ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
when:
steps:
- name: push_step_alpine
Expand Down Expand Up @@ -350,7 +362,7 @@ steps:
arguments:
PIPELINE_ID: 'cli-v1-e2e/root'
VARIABLE:
- CLI_VERSION=${{CF_SHORT_REVISION}}
- CLI_VERSION=${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}
when:
steps:
- name: push_step_alpine
Expand Down
Loading

0 comments on commit d44451c

Please sign in to comment.