Skip to content

Commit 3da12ff

Browse files
Cr 15885 split base (#769)
1 parent 7ef9d3a commit 3da12ff

File tree

5 files changed

+178
-24
lines changed

5 files changed

+178
-24
lines changed

Dockerfile-debian

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
ENTRYPOINT ["codefresh"]

codefresh-arm.yml

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: "1.0"
2-
steps:
2+
steps:
33
main_clone:
44
title: 'Cloning main repository...'
55
type: git-clone
@@ -8,18 +8,31 @@ steps:
88
git: ${{GIT_CONTEXT}}
99

1010
build_image:
11-
title: "Building the image..."
12-
type: build
13-
working_directory: ${{WORKDIR}}
14-
disable_push: true
15-
dockerfile: ./Dockerfile
16-
image_name: ${{IMAGE_NAME}}
17-
tag: ${{CF_SHORT_REVISION}}
11+
type: parallel
12+
steps:
1813

19-
push_dev:
14+
build_image_alpine:
15+
title: "Building the alpine image..."
16+
type: build
17+
working_directory: ${{WORKDIR}}
18+
disable_push: true
19+
dockerfile: ./Dockerfile
20+
image_name: ${{IMAGE_NAME}}
21+
tag: ${{CF_SHORT_REVISION}}
22+
23+
build_image_debian:
24+
title: "Building the debian image..."
25+
type: build
26+
working_directory: ${{WORKDIR}}
27+
disable_push: true
28+
dockerfile: ./Dockerfile-debian
29+
image_name: ${{IMAGE_NAME}}
30+
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
31+
32+
push_dev_alpine:
2033
type: push
21-
candidate: ${{build_image}}
22-
title: "Pushing image to registry with revision tag"
34+
candidate: ${{build_image_alpine}}
35+
title: "Pushing alpine image to registry with revision tag"
2336
tag: ${{CF_SHORT_REVISION}}${{ARM_TAG_POSTFIX}}
2437
scale:
2538
push_quay_dev:
@@ -32,10 +45,26 @@ steps:
3245
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
3346
title: "Pushing image to gcr.io registry with revision tag"
3447

35-
push_master:
48+
push_dev_debian:
3649
type: push
37-
candidate: ${{build_image}}
38-
title: "Pushing image with release tag"
50+
candidate: ${{build_image_debian}}
51+
title: "Pushing debian image to registry with revision tag"
52+
tag: ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}
53+
scale:
54+
push_quay_dev_debian:
55+
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
56+
title: "Pushing image to quay.io registry with revision tag"
57+
push_dockerhub_dev_debian:
58+
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
59+
title: "Pushing image to dockerhub registry with revision tag"
60+
push_gcr_enterprise_dev_debian:
61+
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
62+
title: "Pushing image to gcr.io registry with revision tag"
63+
64+
push_master_alpine:
65+
type: push
66+
candidate: ${{build_image_alpine}}
67+
title: "Pushing alpine image with release tag"
3968
when:
4069
branch:
4170
only: [ master ]
@@ -45,10 +74,31 @@ steps:
4574
scale:
4675
push_quay_prod:
4776
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
48-
title: "Pushing image to quay.io registry with release tag"
77+
title: "Pushing alpine image to quay.io registry with release tag"
4978
push_dockerhub_prod:
5079
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
5180
title: "Pushing image to dockerhub registry with release tag"
5281
push_gcr_enterprise_prod:
5382
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
5483
title: "Pushing image to gcr.io registry with release tag"
84+
85+
push_master_debian:
86+
type: push
87+
candidate: ${{build_image_debian}}
88+
title: "Pushing debian image with release tag"
89+
when:
90+
branch:
91+
only: [ master ]
92+
tags:
93+
- "${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
94+
- "latest${{DEBIAN_TAG_POSTFIX}}${{ARM_TAG_POSTFIX}}"
95+
scale:
96+
push_quay_prod_debian:
97+
registry: "${{REGISTRY_INTEGRATION_QUAY}}"
98+
title: "Pushing image to quay.io registry with release tag"
99+
push_dockerhub_prod_debian:
100+
registry: "${{REGISTRY_INTEGRATION_DOCKERHUB}}"
101+
title: "Pushing image to dockerhub registry with release tag"
102+
push_gcr_enterprise_prod_debian:
103+
registry: "${{REGISTRY_INTEGRATION_ENTERPRISE}}"
104+
title: "Pushing image to gcr.io registry with release tag"

codefresh-release.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ steps:
7272
- success
7373

7474
# in case the candidate image will not be found the release flow will crash and this means that the build pipelines has failed
75-
push_step:
75+
push_step_alpine:
7676
stage: docker
7777
type: push
78-
title: "Push release image"
78+
title: "Push alpine release image"
7979
image_name: codefresh/cli
8080
tags:
8181
- ${{PACKAGE_VERSION}}
@@ -98,6 +98,32 @@ steps:
9898
on:
9999
- success
100100

101+
push_step_debian:
102+
stage: docker
103+
type: push
104+
title: "Push debian release image"
105+
image_name: codefresh/cli
106+
tags:
107+
- ${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}
108+
- latest${{DEBIAN_TAG_POSTFIX}}
109+
scale:
110+
push_to_dockerhub:
111+
registry: dockerhub
112+
title: "push to dockerhub"
113+
candidate: codefresh/cli:${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
114+
push_to_gcr:
115+
title: "push to gcr"
116+
candidate: gcr.io/codefresh-inc/codefresh/cli:${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
117+
push_to_quay:
118+
registry: cf-quay
119+
title: "push to quay.io"
120+
candidate: quay.io/codefresh/cli:${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
121+
when:
122+
steps:
123+
- name: extract_version
124+
on:
125+
- success
126+
101127
create_manifest_list:
102128
stage: docker
103129
type: "codefresh-inc/multiarch-manifester"
@@ -117,14 +143,22 @@ steps:
117143
username: '${{GCR_CODEFRESH_INC_USERNAME}}'
118144
password: '${{GCR_CODEFRESH_INC_PASSWORD}}'
119145
scale:
120-
master_branch_tags:
146+
master_branch_tags_alpine:
121147
arguments:
122148
tags:
123149
- ${{PACKAGE_VERSION}}
124150
- latest
151+
master_branch_tags_debian:
152+
arguments:
153+
tags:
154+
- ${{PACKAGE_VERSION}}${{DEBIAN_TAG_POSTFIX}}
155+
- latest${{DEBIAN_TAG_POSTFIX}}
125156
when:
126157
steps:
127-
- name: push_step
158+
- name: push_step_alpine
159+
on:
160+
- success
161+
- name: push_step_debian
128162
on:
129163
- success
130164

codefresh.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,18 @@ steps:
7676
type: parallel
7777
steps:
7878

79-
build_step:
79+
build_step_alpine:
8080
type: build
8181
dockerfile: Dockerfile
8282
image-name: codefresh/cli
8383
tag: ${{CF_BRANCH_TAG_NORMALIZED}}
8484

85+
build_step_debian:
86+
type: build
87+
dockerfile: Dockerfile-debian
88+
image-name: codefresh/cli
89+
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}
90+
8591
run_arm_build:
8692
type: codefresh-run
8793
arguments:
@@ -99,12 +105,13 @@ steps:
99105
- IMAGE_NAME=codefresh/cli
100106
- WORKDIR=${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}
101107
- ARM_TAG_POSTFIX="${{ARM_TAG_POSTFIX}}"
108+
- DEBIAN_TAG_POSTFIX="${{DEBIAN_TAG_POSTFIX}}"
102109
- PACKAGE_VERSION=${{PACKAGE_VERSION}}
103110

104-
push_step:
111+
push_step_alpine:
105112
type: push
106113
tag: '${{CF_SHORT_REVISION}}'
107-
candidate: ${{build_step}}
114+
candidate: ${{build_step_alpine}}
108115
scale:
109116
push_to_dockerhub:
110117
registry: dockerhub
@@ -115,6 +122,20 @@ steps:
115122
registry: cf-quay
116123
title: "push to quay.io"
117124

125+
push_step_debian:
126+
type: push
127+
tag: '${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}'
128+
candidate: ${{build_step_debian}}
129+
scale:
130+
push_to_dockerhub_debian:
131+
registry: dockerhub
132+
title: "push to dockerhub"
133+
push_to_gcr_debian:
134+
title: "push to gcr"
135+
push_to_quay_debian:
136+
registry: cf-quay
137+
title: "push to quay.io"
138+
118139
create_manifest_list:
119140
type: "codefresh-inc/multiarch-manifester"
120141
arguments:
@@ -140,6 +161,13 @@ steps:
140161
arguments:
141162
tags:
142163
- ${{CF_SHORT_REVISION}}
164+
dev_branches_tags_debian:
165+
when:
166+
branch:
167+
ignore: [ master ]
168+
arguments:
169+
tags:
170+
- ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
143171

144172
fail_on_bad_version:
145173
image: codefresh/build-cli
@@ -159,6 +187,8 @@ steps:
159187
BRANCH: master
160188
VARIABLE:
161189
- PACKAGE_VERSION=${{PACKAGE_VERSION}}
190+
- ARM_TAG_POSTFIX="${{ARM_TAG_POSTFIX}}"
191+
- DEBIAN_TAG_POSTFIX="${{DEBIAN_TAG_POSTFIX}}"
162192
when:
163193
branch:
164194
only: [ master ]

lib/interface/cli/completion/completion.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ jest.mock('fs', () => {
136136
}
137137
};
138138
return Object.assign(jest.requireActual('fs'), {
139-
lstat: (p, options, callback) => callback(null, lstatSync(p)),
140-
stat: (p, options, callback) => callback(null, lstatSync(p)),
139+
lstat: (p, callback) => callback(null, lstatSync(p)),
140+
stat: (p, callback) => callback(null, lstatSync(p)),
141141
access: (path, c) => c(null, true),
142142
readdirSync,
143143
existsSync,

0 commit comments

Comments
 (0)