forked from codefresh-io/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodefresh.yml
More file actions
195 lines (177 loc) · 5.38 KB
/
codefresh.yml
File metadata and controls
195 lines (177 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# this pipeline should not be run on version tag releases (it may cause a non correct sha to override version tagged image in dockerhub)
version: "1.0"
steps:
main_clone:
title: 'Cloning main repository...'
type: git-clone
repo: codefresh-io/cli
revision: ${{CF_BRANCH}}
git: cf_github
extract_version:
title: "Exporting package.json version"
image: codefresh/build-cli
commands:
- 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
- "echo Current version: $PACKAGE_VERSION"
- "cf_export PACKAGE_VERSION"
check_version:
title: 'Checking if version already exists'
image: codefresh/build-cli
fail_fast: false
commands:
- >-
RELEASE_ID="$(curl -s https://api.github.com/repos/codefresh-io/cli/releases/tags/v${{PACKAGE_VERSION}} | jq .id)"
echo "Release id: $RELEASE_ID"
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = 'null' ]; then
echo "Version is ok: ${{PACKAGE_VERSION}}"
else
echo "Release already exists ${{PACKAGE_VERSION}}"
exit 1
fi
when:
condition:
all:
skipVersionCheck: '"${{SKIP_VERSION_CHECK}}" != "true"'
install_dependencies:
title: 'Installing testing dependencies'
image: codefresh/build-cli
commands:
- yarn install --frozen-lockfile
parallel_tests:
type: parallel
steps:
eslint:
title: 'Running linting logic'
image: codefresh/build-cli
commands:
- yarn eslint
unit_tests:
title: 'Running unit tests'
image: codefresh/build-cli
commands:
- yarn test
# Disabled e2e tests because of flakyness
# need to fix flakyness before enabling again.
#
# e2e_tests:
# title: 'Running e2e tests'
# image: codefresh/build-cli
# commands:
# - "echo Running e2e on account: ${{CF_ACCOUNT}}"
# - CF_API_KEY=${{CF_E2E_API_KEY}} yarn e2e
when:
branch:
ignore: [ master ]
build_images:
type: parallel
steps:
build_step_alpine:
type: build
dockerfile: Dockerfile
image-name: codefresh/cli
tag: ${{CF_BRANCH_TAG_NORMALIZED}}
build_step_debian:
type: build
dockerfile: Dockerfile-debian
image-name: codefresh/cli
tag: ${{CF_BRANCH_TAG_NORMALIZED}}${{DEBIAN_TAG_POSTFIX}}
run_arm_build:
type: codefresh-run
arguments:
PIPELINE_ID: codefresh-io/cli/build-arm
TRIGGER_ID: codefresh-io/cli
BRANCH: ${{CF_BRANCH}}
DETACH: false
VARIABLE:
- CF_REPO_OWNER=${{CF_REPO_OWNER}}
- CF_REPO_NAME=${{CF_REPO_NAME}}
- CF_REVISION=${{CF_REVISION}}
- CF_BRANCH=${{CF_BRANCH}}
- CF_SHORT_REVISION=${{CF_SHORT_REVISION}}
- GIT_CONTEXT=cf_github
- IMAGE_NAME=codefresh/cli
- WORKDIR=${{CF_VOLUME_PATH}}/${{CF_REPO_NAME}}
- ARM_TAG_POSTFIX="${{ARM_TAG_POSTFIX}}"
- DEBIAN_TAG_POSTFIX="${{DEBIAN_TAG_POSTFIX}}"
- PACKAGE_VERSION=${{PACKAGE_VERSION}}
push_step_alpine:
type: push
tag: '${{CF_SHORT_REVISION}}'
candidate: ${{build_step_alpine}}
scale:
push_to_dockerhub:
registry: dockerhub
title: "push to dockerhub"
push_to_gcr:
title: "push to gcr"
push_to_quay:
registry: cf-quay
title: "push to quay.io"
push_step_debian:
type: push
tag: '${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}'
candidate: ${{build_step_debian}}
scale:
push_to_dockerhub_debian:
registry: dockerhub
title: "push to dockerhub"
push_to_gcr_debian:
title: "push to gcr"
push_to_quay_debian:
registry: cf-quay
title: "push to quay.io"
create_manifest_list:
type: "codefresh-inc/multiarch-manifester"
arguments:
image_name: codefresh/cli
arch_tag_postfixes:
arm64: "${{ARM_TAG_POSTFIX}}"
registries:
- name: 'quay.io'
username: '${{QUAY_USERNAME}}'
password: '${{QUAY_PASSWORD}}'
- name: 'docker.io'
username: '${{DOCKERHUB_USERNAME}}'
password: '${{DOCKERHUB_PASSWORD}}'
- name: 'gcr.io'
path_prefix: codefresh-inc
username: '${{GCR_CODEFRESH_INC_USERNAME}}'
password: '${{GCR_CODEFRESH_INC_PASSWORD}}'
scale:
dev_branches_tags:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}
dev_branches_tags_debian:
when:
branch:
ignore: [ master ]
arguments:
tags:
- ${{CF_SHORT_REVISION}}${{DEBIAN_TAG_POSTFIX}}
fail_on_bad_version:
image: codefresh/build-cli
commands:
- exit 1
when:
condition:
all:
versionCheckFailed: steps.check_version.result == 'failure'
execute_release_pipeline:
title: "Execute release pipeline in case version was changed"
type: codefresh-run
arguments:
PIPELINE_ID: 'codefresh-io/cli/release'
DETACH: true
BRANCH: master
VARIABLE:
- PACKAGE_VERSION=${{PACKAGE_VERSION}}
when:
branch:
only: [ master ]
condition:
all:
versionCheckSucceeded: steps.check_version.result != 'failure'