Skip to content

Commit 3c6636a

Browse files
CR-16573 -- fix (#790)
* add rootless * Revert "CR-16573 -- rootless (#789)" This reverts commit 059fc5b. * boost pipelines * fix bootsted pipelines * reorganize boosted pipelines * fix arm tagging
1 parent 059fc5b commit 3c6636a

File tree

9 files changed

+487
-51
lines changed

9 files changed

+487
-51
lines changed

Dockerfile

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,4 @@ RUN yarn generate-completion
3535
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
3636

3737
RUN codefresh components update --location components
38-
39-
# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
40-
# and we do not want to break user automation if he used to bind his .cfconfig
41-
# to the /root/.cfconfig
42-
RUN adduser -D -h /root -s /bin/sh cfu \
43-
&& chown -R $(id -g cfu) /root /cf-cli \
44-
&& chgrp -R $(id -g cfu) /root /cf-cli \
45-
&& chmod -R g+rwX /root
46-
47-
USER cfu
48-
4938
ENTRYPOINT ["codefresh"]

Dockerfile-debian

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,4 @@ RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
3737

3838
RUN codefresh components update --location components
3939

40-
# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
41-
# and we do not want to break user automation if he used to bind his .cfconfig
42-
# to the /root/.cfconfig
43-
RUN useradd -m -d /root -s /bin/sh cfu \
44-
&& chown -R $(id -g cfu) /root /cf-cli \
45-
&& chgrp -R $(id -g cfu) /root /cf-cli \
46-
&& chmod -R g+rwX /root
47-
48-
USER cfu
49-
5040
ENTRYPOINT ["codefresh"]

Dockerfile-debian-rootless

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# go hub binary
2+
FROM golang:alpine as go
3+
RUN apk --update add ca-certificates git
4+
RUN go install github.com/github/hub@latest
5+
6+
# python yq binary
7+
FROM six8/pyinstaller-alpine:alpine-3.6-pyinstaller-v3.4 as yq
8+
ARG YQ_VERSION=2.10.0
9+
ENV PATH="/pyinstaller:$PATH"
10+
RUN pip install yq==${YQ_VERSION}
11+
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
12+
13+
# Main
14+
FROM node:18.12.1-bullseye-slim
15+
16+
RUN apt update
17+
RUN apt -y install ca-certificates git curl bash jq busybox && ln -s /bin/busybox /usr/bin/[[
18+
19+
COPY --from=go /go/bin/hub /usr/local/bin/hub
20+
COPY --from=yq /tmp/yq /usr/local/bin/yq
21+
22+
WORKDIR /cf-cli
23+
24+
COPY package.json /cf-cli
25+
COPY yarn.lock /cf-cli
26+
COPY check-version.js /cf-cli
27+
COPY run-check-version.js /cf-cli
28+
29+
RUN yarn install --prod --frozen-lockfile && \
30+
yarn cache clean
31+
32+
COPY . /cf-cli
33+
34+
RUN yarn generate-completion
35+
36+
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
37+
38+
RUN codefresh components update --location components
39+
40+
# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
41+
# and we do not want to break user automation if he used to bind his .cfconfig
42+
# to the /root/.cfconfig
43+
RUN useradd -m -d /root -s /bin/sh cfu \
44+
&& chown -R $(id -g cfu) /root /cf-cli \
45+
&& chgrp -R $(id -g cfu) /root /cf-cli \
46+
&& chmod -R g+rwX /root
47+
48+
USER cfu
49+
50+
ENTRYPOINT ["codefresh"]

Dockerfile-rootless

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# go hub binary
2+
FROM golang:alpine as go
3+
RUN apk --update add ca-certificates git
4+
RUN go install github.com/github/hub@latest
5+
6+
# python yq binary
7+
FROM six8/pyinstaller-alpine:alpine-3.6-pyinstaller-v3.4 as yq
8+
ARG YQ_VERSION=2.10.0
9+
ENV PATH="/pyinstaller:$PATH"
10+
RUN pip install yq==${YQ_VERSION}
11+
RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
12+
13+
# Main
14+
FROM node:18.12.1-alpine3.15
15+
16+
RUN apk --update add --no-cache ca-certificates git curl bash jq
17+
18+
COPY --from=go /go/bin/hub /usr/local/bin/hub
19+
COPY --from=yq /tmp/yq /usr/local/bin/yq
20+
21+
WORKDIR /cf-cli
22+
23+
COPY package.json /cf-cli
24+
COPY yarn.lock /cf-cli
25+
COPY check-version.js /cf-cli
26+
COPY run-check-version.js /cf-cli
27+
28+
RUN yarn install --prod --frozen-lockfile && \
29+
yarn cache clean
30+
31+
COPY . /cf-cli
32+
33+
RUN yarn generate-completion
34+
35+
RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
36+
37+
RUN codefresh components update --location components
38+
39+
# we keep /root as home directory because cli by default looks for $HOME/.cfconfig
40+
# and we do not want to break user automation if he used to bind his .cfconfig
41+
# to the /root/.cfconfig
42+
RUN adduser -D -h /root -s /bin/sh cfu \
43+
&& chown -R $(id -g cfu) /root /cf-cli \
44+
&& chgrp -R $(id -g cfu) /root /cf-cli \
45+
&& chmod -R g+rwX /root
46+
47+
USER cfu
48+
49+
ENTRYPOINT ["codefresh"]

codefresh-arm.yml

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
version: "1.0"
2+
mode: parallel
3+
stages:
4+
- prepare
5+
- build
6+
- push-dev
7+
- push-master
28
steps:
39
main_clone:
10+
stage: prepare
411
title: 'Cloning main repository...'
512
type: git-clone
613
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}
714
revision: ${{CF_REVISION}}
815
git: ${{GIT_CONTEXT}}
916

1017
build_image:
18+
stage: build
1119
type: parallel
1220
steps:
1321

@@ -29,7 +37,31 @@ steps:
2937
image_name: ${{IMAGE_NAME}}
3038
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
3139

40+
build_image_alpine_rootless:
41+
title: "Building the alpine image..."
42+
type: build
43+
working_directory: ${{WORKDIR}}
44+
disable_push: true
45+
dockerfile: ./Dockerfile-rootless
46+
image_name: ${{IMAGE_NAME}}
47+
tag: ${{CF_SHORT_REVISION}}${{ROOTLESS_TAG_POSTFIX}}
48+
49+
build_image_debian_rootless:
50+
title: "Building the debian image..."
51+
type: build
52+
working_directory: ${{WORKDIR}}
53+
disable_push: true
54+
dockerfile: ./Dockerfile-debian-rootless
55+
image_name: ${{IMAGE_NAME}}
56+
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}
57+
when:
58+
steps:
59+
- name: main_clone
60+
on:
61+
- success
62+
3263
push_dev_alpine:
64+
stage: push-dev
3365
type: push
3466
candidate: ${{build_image_alpine}}
3567
title: "Pushing alpine image to registry with revision tag"
@@ -44,8 +76,14 @@ steps:
4476
push_gcr_enterprise_dev:
4577
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
4678
title: "Pushing image to gcr.io registry with revision tag"
79+
when:
80+
steps:
81+
- name: build_image
82+
on:
83+
- success
4784

4885
push_dev_debian:
86+
stage: push-dev
4987
type: push
5088
candidate: ${{build_image_debian}}
5189
title: "Pushing debian image to registry with revision tag"
@@ -60,14 +98,68 @@ steps:
6098
push_gcr_enterprise_dev_debian:
6199
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
62100
title: "Pushing image to gcr.io registry with revision tag"
101+
when:
102+
steps:
103+
- name: build_image
104+
on:
105+
- success
106+
107+
push_dev_alpine_rootless:
108+
stage: push-dev
109+
type: push
110+
candidate: ${{build_image_alpine_rootless}}
111+
title: "Pushing rootless alpine image to registry with revision tag"
112+
tag: ${{CF_SHORT_REVISION}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
113+
scale:
114+
push_quay_dev_rootless:
115+
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
116+
title: "Pushing image to quay.io registry with revision tag"
117+
push_dockerhub_dev_rootless:
118+
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
119+
title: "Pushing image to dockerhub registry with revision tag"
120+
push_gcr_enterprise_dev_rootless:
121+
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
122+
title: "Pushing image to gcr.io registry with revision tag"
123+
when:
124+
steps:
125+
- name: build_image
126+
on:
127+
- success
128+
129+
push_dev_debian_rootless:
130+
stage: push-dev
131+
type: push
132+
candidate: ${{build_image_debian_rootless}}
133+
title: "Pushing rootless debian image to registry with revision tag"
134+
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
135+
scale:
136+
push_quay_dev_debian_rootless:
137+
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
138+
title: "Pushing image to quay.io registry with revision tag"
139+
push_dockerhub_dev_debian_rootless:
140+
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
141+
title: "Pushing image to dockerhub registry with revision tag"
142+
push_gcr_enterprise_dev_debian_rootless:
143+
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
144+
title: "Pushing image to gcr.io registry with revision tag"
145+
when:
146+
steps:
147+
- name: build_image
148+
on:
149+
- success
63150

64151
push_master_alpine:
152+
stage: push-master
65153
type: push
66154
candidate: ${{build_image_alpine}}
67155
title: "Pushing alpine image with release tag"
68156
when:
69157
branch:
70158
only: [ master ]
159+
steps:
160+
- name: build_image
161+
on:
162+
- success
71163
tags:
72164
- "${{PACKAGE_VERSION}}${{ARM_TAG_POSTFIX}}"
73165
- "latest${{ARM_TAG_POSTFIX}}"
@@ -83,12 +175,17 @@ steps:
83175
title: "Pushing image to gcr.io registry with release tag"
84176

85177
push_master_debian:
178+
stage: push-master
86179
type: push
87180
candidate: ${{build_image_debian}}
88181
title: "Pushing debian image with release tag"
89182
when:
90183
branch:
91184
only: [ master ]
185+
steps:
186+
- name: build_image
187+
on:
188+
- success
92189
tags:
93190
- "${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
94191
- "latest${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
@@ -102,3 +199,55 @@ steps:
102199
push_gcr_enterprise_prod_debian:
103200
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
104201
title: "Pushing image to gcr.io registry with release tag"
202+
203+
push_master_alpine_rootless:
204+
stage: push-master
205+
type: push
206+
candidate: ${{build_image_alpine_rootless}}
207+
title: "Pushing rootless alpine image with release tag"
208+
when:
209+
branch:
210+
only: [ master ]
211+
steps:
212+
- name: build_image
213+
on:
214+
- success
215+
tags:
216+
- "${{PACKAGE_VERSION}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
217+
- "latest${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
218+
scale:
219+
push_quay_prod_rootless:
220+
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
221+
title: "Pushing alpine image to quay.io registry with release tag"
222+
push_dockerhub_prod_rootless:
223+
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
224+
title: "Pushing image to dockerhub registry with release tag"
225+
push_gcr_enterprise_prod_rootless:
226+
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
227+
title: "Pushing image to gcr.io registry with release tag"
228+
229+
push_master_debian_rootless:
230+
stage: push-master
231+
type: push
232+
candidate: ${{build_image_debian_rootless}}
233+
title: "Pushing rootless debian image with release tag"
234+
when:
235+
branch:
236+
only: [ master ]
237+
steps:
238+
- name: build_image
239+
on:
240+
- success
241+
tags:
242+
- "${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
243+
- "latest${{DEBIAN_TAG_POSTFIX}}${{ROOTLESS_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
244+
scale:
245+
push_quay_prod_debian_rootless:
246+
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
247+
title: "Pushing image to quay.io registry with release tag"
248+
push_dockerhub_prod_debian_rootless:
249+
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
250+
title: "Pushing image to dockerhub registry with release tag"
251+
push_gcr_enterprise_prod_debian_rootless:
252+
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
253+
title: "Pushing image to gcr.io registry with release tag"

0 commit comments

Comments
 (0)