codefresh 0.78.3 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.dockerignore +1 -0
  2. package/Dockerfile +3 -4
  3. package/check-version.js +1 -1
  4. package/codefresh-release.yml +265 -61
  5. package/codefresh.yml +64 -20
  6. package/e2e/README.md +10 -0
  7. package/e2e/data/crud.pip.yaml +23 -0
  8. package/e2e/data/test-run.pip.yaml +23 -0
  9. package/e2e/e2e.spec.sh +25 -0
  10. package/e2e/helpers.sh +10 -0
  11. package/e2e/scenarios/agents.sh +1 -0
  12. package/e2e/scenarios/annotations.sh +2 -0
  13. package/e2e/scenarios/boards.sh +3 -0
  14. package/e2e/scenarios/builds.sh +1 -0
  15. package/e2e/scenarios/clusters.sh +1 -0
  16. package/e2e/scenarios/compositions.sh +1 -0
  17. package/e2e/scenarios/contexts.sh +1 -0
  18. package/e2e/scenarios/environments.sh +1 -0
  19. package/e2e/scenarios/helm-repo.sh +1 -0
  20. package/e2e/scenarios/images.sh +1 -0
  21. package/e2e/scenarios/pipeline-run.sh +26 -0
  22. package/e2e/scenarios/pipelines.sh +31 -0
  23. package/e2e/scenarios/projects.sh +17 -0
  24. package/e2e/scenarios/registry.sh +1 -0
  25. package/e2e/scenarios/repository.sh +2 -0
  26. package/e2e/scenarios/runtime-environment.sh +1 -0
  27. package/e2e/scenarios/step-types.sh +1 -0
  28. package/e2e/scenarios/system-runtime-environments.sh +1 -0
  29. package/e2e/scenarios/teams.sh +1 -0
  30. package/e2e/scenarios/tokens.sh +1 -0
  31. package/e2e/scenarios/triggers.sh +3 -0
  32. package/lib/interface/cli/commands/workflow/logs.cmd.js +6 -1
  33. package/lib/interface/cli/completion/completion.spec.js +18 -15
  34. package/lib/interface/cli/helpers/helpers.sdk.spec.js +0 -9
  35. package/lib/interface/cli/helpers/logs.js +2 -12
  36. package/lib/logic/cli-config/Manager.js +4 -5
  37. package/lib/logic/cli-config/Model.js +4 -5
  38. package/lib/logic/cli-config/manager.spec.js +10 -13
  39. package/lib/logic/entities/Agent.js +1 -3
  40. package/lib/logic/entities/CodefreshRepo.js +1 -1
  41. package/lib/logic/entities/Entity.js +1 -0
  42. package/lib/logic/entities/Environment.js +1 -0
  43. package/lib/logic/entities/GitRepo.js +1 -1
  44. package/lib/logic/entities/HelmRepo.js +1 -2
  45. package/lib/logic/entities/Pipeline.js +1 -1
  46. package/lib/logic/entities/RuntimeEnvironments.js +1 -1
  47. package/lib/logic/entities/StepType.js +2 -2
  48. package/lib/logic/entities/StepTypeVersion.js +0 -1
  49. package/lib/logic/entities/Team.js +2 -2
  50. package/lib/logic/entities/Token.js +2 -2
  51. package/lib/logic/entities/Workflow.js +1 -1
  52. package/lib/logic/index.js +0 -2
  53. package/package.json +35 -23
  54. package/yarn.lock +1522 -907
package/.dockerignore CHANGED
@@ -12,3 +12,4 @@ codefresh.yml
12
12
  .coveralls.yml
13
13
  examples
14
14
  dist
15
+ e2e
package/Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # go hub binary
2
2
  FROM golang:alpine as go
3
3
  RUN apk --update add ca-certificates git
4
- RUN go get github.com/github/hub
4
+ RUN go install github.com/github/hub@latest
5
5
 
6
6
  # python yq binary
7
7
  FROM six8/pyinstaller-alpine:alpine-3.6-pyinstaller-v3.4 as yq
@@ -11,9 +11,9 @@ RUN pip install yq==${YQ_VERSION}
11
11
  RUN pyinstaller --noconfirm --onefile --log-level DEBUG --clean --distpath /tmp/ $(which yq)
12
12
 
13
13
  # Main
14
- FROM node:10.23.0-alpine3.11
14
+ FROM node:12.22.11-alpine3.15
15
15
 
16
- RUN apk --update add --no-cache ca-certificates git curl bash yarn jq=1.6-r0
16
+ RUN apk --update add --no-cache ca-certificates git curl bash jq
17
17
 
18
18
  COPY --from=go /go/bin/hub /usr/local/bin/hub
19
19
  COPY --from=yq /tmp/yq /usr/local/bin/yq
@@ -31,7 +31,6 @@ RUN yarn install --prod --frozen-lockfile && \
31
31
  COPY . /cf-cli
32
32
 
33
33
  RUN yarn generate-completion
34
- RUN apk del yarn
35
34
 
36
35
  RUN ln -s $(pwd)/lib/interface/cli/codefresh /usr/local/bin/codefresh
37
36
 
package/check-version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const semver = require('semver');
2
- const { engines } = require('./package');
2
+ const { engines } = require('./package.json');
3
3
 
4
4
  function checkVersion(version = engines.node) {
5
5
  if (!semver.satisfies(process.version, version)) {
@@ -1,16 +1,16 @@
1
1
  # this pipeline should only be executed on master branch
2
2
  version: '1.0'
3
-
3
+ mode: parallel
4
+ stages:
5
+ - prepare
6
+ - docker
7
+ - build
8
+ - github
9
+ - packages
10
+ - documentation
4
11
  steps:
5
-
6
- main_clone:
7
- title: 'Cloning main repository...'
8
- type: git-clone
9
- repo: codefresh-io/cli
10
- revision: ${{CF_BRANCH}}
11
- git: cf_github
12
-
13
12
  fail_if_not_master:
13
+ stage: prepare
14
14
  title: "Validate running on master branch"
15
15
  image: codefresh/build-cli
16
16
  commands:
@@ -20,16 +20,60 @@ steps:
20
20
  branch:
21
21
  ignore: [ master ]
22
22
 
23
+ main_clone:
24
+ stage: prepare
25
+ title: 'Cloning main repository...'
26
+ type: git-clone
27
+ repo: codefresh-io/cli
28
+ revision: ${{CF_BRANCH}}
29
+ git: cf_github
30
+ when:
31
+ steps:
32
+ - name: fail_if_not_master
33
+ on:
34
+ - success
35
+
23
36
  extract_version:
37
+ stage: prepare
24
38
  title: "Exporting package.json version"
25
39
  image: codefresh/build-cli
26
40
  commands:
27
41
  - 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
28
42
  - "echo Current version: $PACKAGE_VERSION"
29
43
  - "cf_export PACKAGE_VERSION"
44
+ when:
45
+ steps:
46
+ - name: main_clone
47
+ on:
48
+ - success
49
+
50
+ install:
51
+ stage: prepare
52
+ title: "Installing dependencies"
53
+ image: codefresh/build-cli
54
+ commands:
55
+ - "yarn install"
56
+ when:
57
+ steps:
58
+ - name: main_clone
59
+ on:
60
+ - success
61
+
62
+ generate_comletion:
63
+ stage: prepare
64
+ title: "Generating commands completion tree"
65
+ image: codefresh/build-cli
66
+ commands:
67
+ - "yarn generate-completion"
68
+ when:
69
+ steps:
70
+ - name: install
71
+ on:
72
+ - success
30
73
 
31
- # in case the candidate image will not be found the release flow will crash and this means that the build pipelines has failed
74
+ # in case the candidate image will not be found the release flow will crash and this means that the build pipelines has failed
32
75
  push_step:
76
+ stage: docker
33
77
  type: push
34
78
  title: "Push release image"
35
79
  image_name: codefresh/cli
@@ -48,8 +92,14 @@ steps:
48
92
  registry: cf-quay
49
93
  title: "push to quay.io"
50
94
  candidate: quay.io/codefresh/cli:${{CF_SHORT_REVISION}}
95
+ when:
96
+ steps:
97
+ - name: extract_version
98
+ on:
99
+ - success
51
100
 
52
101
  create_manifest_list:
102
+ stage: docker
53
103
  type: "codefresh-inc/multiarch-manifester"
54
104
  arguments:
55
105
  image_name: codefresh/cli
@@ -72,27 +122,91 @@ steps:
72
122
  tags:
73
123
  - ${{PACKAGE_VERSION}}
74
124
  - latest
75
-
76
- generate_comletion:
77
- title: "Generating commands completion tree"
78
- image: codefresh/build-cli
79
- commands:
80
- - "yarn install"
81
- - "yarn generate-completion"
82
-
83
- deploy_to_npm:
84
- title: "Publishing To Npm"
85
- type: npm-publish
86
- arguments:
87
- NPM_TOKEN: '${{NPM_TOKEN}}'
88
- DIR: ./cli
125
+ when:
126
+ steps:
127
+ - name: push_step
128
+ on:
129
+ - success
89
130
 
90
131
  compile_executables:
132
+ stage: build
91
133
  title: "Compiling executables"
92
134
  image: codefresh/build-cli
93
135
  commands:
94
136
  - "rm -rf dist"
95
137
  - "yarn pkg"
138
+ when:
139
+ steps:
140
+ - name: generate_comletion
141
+ on:
142
+ - success
143
+
144
+ archive_linux:
145
+ stage: build
146
+ title: "Archiving linux distribution"
147
+ image: codefresh/build-cli
148
+ commands:
149
+ - "rm -rf ./dist/linux"
150
+ - "mkdir -p ./dist/linux"
151
+ - "cp --force README.md LICENSE ./dist/linux"
152
+ - "cp --force ./dist/codefresh-linux ./dist/linux/codefresh"
153
+ - "tar -cf codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar README.md LICENSE -C ./dist/linux codefresh"
154
+ - "gzip -f codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar"
155
+ when:
156
+ steps:
157
+ - name: compile_executables
158
+ on:
159
+ - success
160
+
161
+ archive_macos:
162
+ stage: build
163
+ title: "Archiving macos distribution"
164
+ image: codefresh/build-cli
165
+ commands:
166
+ - "rm -rf ./dist/macos"
167
+ - "mkdir -p ./dist/macos"
168
+ - "cp --force README.md LICENSE ./dist/macos"
169
+ - "cp --force ./dist/codefresh-macos ./dist/macos/codefresh"
170
+ - "tar -cf codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar README.md LICENSE -C ./dist/macos codefresh"
171
+ - "gzip -f codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar"
172
+ when:
173
+ steps:
174
+ - name: compile_executables
175
+ on:
176
+ - success
177
+
178
+ archive_win:
179
+ stage: build
180
+ title: "Archiving macos distribution"
181
+ image: codefresh/build-cli
182
+ commands:
183
+ - "rm -rf ./dist/win"
184
+ - "mkdir -p ./dist/win"
185
+ - "cp --force README.md LICENSE ./dist/win"
186
+ - "cp --force ./dist/codefresh-win ./dist/win/codefresh.exe"
187
+ - "zip codefresh-v${{PACKAGE_VERSION}}-win-x64.zip README.md LICENSE -j ./dist/win/codefresh.exe "
188
+ when:
189
+ steps:
190
+ - name: compile_executables
191
+ on:
192
+ - success
193
+
194
+ archive_alpine:
195
+ stage: build
196
+ title: "Archiving macos distribution"
197
+ image: codefresh/build-cli
198
+ commands:
199
+ - "rm -rf ./dist/alpine"
200
+ - "mkdir -p ./dist/alpine"
201
+ - "cp --force README.md LICENSE ./dist/alpine"
202
+ - "cp --force ./dist/codefresh-alpine ./dist/alpine/codefresh"
203
+ - "tar -cf codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar README.md LICENSE -C ./dist/alpine codefresh"
204
+ - "gzip -f codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar"
205
+ when:
206
+ steps:
207
+ - name: compile_executables
208
+ on:
209
+ - success
96
210
 
97
211
  create_release:
98
212
  title: "Create github release"
@@ -100,6 +214,11 @@ steps:
100
214
  fail_fast: false
101
215
  commands:
102
216
  - 'curl --fail -X POST -d ''{"tag_name":"v${{PACKAGE_VERSION}}","target_commitish":"${{CF_REVISION}}","name":"Codefresh V${{PACKAGE_VERSION}}"}'' -H "Content-Type: application/json" -H "Authorization: token ${{GITHUB_TOKEN}}" https://api.github.com/repos/codefresh-io/cli/releases'
217
+ when:
218
+ steps:
219
+ - name: compile_executables
220
+ on:
221
+ - success
103
222
 
104
223
  get_release:
105
224
  title: "Get github release"
@@ -109,57 +228,97 @@ steps:
109
228
  - "export GITHUB_RELEASE_ID=$(curl --fail https://api.github.com/repos/codefresh-io/cli/releases/tags/v${{PACKAGE_VERSION}} | jq -r '.id')"
110
229
  - "echo Github release id: $GITHUB_RELEASE_ID"
111
230
  - "cf_export GITHUB_RELEASE_ID"
231
+ when:
232
+ steps:
233
+ - name: create_release
234
+ on:
235
+ - success
112
236
 
113
- upload_executables:
114
- title: "Upload executables to github release"
237
+ upload_linux:
238
+ stage: github
239
+ title: "Upload linux executable to github release"
115
240
  image: codefresh/build-cli
116
241
  commands:
117
- # delete all previous .zip/.gz created files and copy readme and license to ./dist
118
- - "rm -rf *.gz"
119
- - "rm -rf *.zip"
120
- - "cp README.md LICENSE ./dist --force"
121
- # upload linux-x64 asset
122
- - "mv ./dist/codefresh-linux ./dist/codefresh"
123
- - "tar -cf codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar README.md LICENSE -C ./dist ./codefresh "
124
- - "gzip codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar"
242
+ # upload linux-x64 asset
125
243
  - 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar.gz https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-linux-x64.tar.gz'
126
- # upload macos-x64 asset
127
- - "mv ./dist/codefresh-macos ./dist/codefresh"
128
- - "tar -cf codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar README.md LICENSE -C ./dist ./codefresh "
129
- - "gzip codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar"
244
+ when:
245
+ steps:
246
+ - name: get_release
247
+ on:
248
+ - success
249
+ - name: archive_linux
250
+ on:
251
+ - success
252
+
253
+ upload_macos:
254
+ stage: github
255
+ title: "Upload macos executable to github release"
256
+ image: codefresh/build-cli
257
+ commands:
258
+ # upload macos-x64 asset
130
259
  - 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar.gz https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-macos-x64.tar.gz'
131
- # upload win-x64 asset
132
- - "mv ./dist/codefresh-win.exe ./dist/codefresh.exe"
133
- - "zip codefresh-v${{PACKAGE_VERSION}}-win-x64.zip README.md LICENSE -j ./dist/codefresh.exe "
260
+ when:
261
+ steps:
262
+ - name: get_release
263
+ on:
264
+ - success
265
+ - name: archive_macos
266
+ on:
267
+ - success
268
+
269
+ upload_win:
270
+ stage: github
271
+ title: "Upload win executable to github release"
272
+ image: codefresh/build-cli
273
+ commands:
274
+ # upload win-x64 asset
134
275
  - 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-win-x64.zip https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-win-x64.zip'
135
- # upload alpine-x64 asset
136
- - "mv ./dist/codefresh-alpine ./dist/codefresh"
137
- - "tar -cf codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar README.md LICENSE -C ./dist ./codefresh "
138
- - "gzip codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar"
139
- - 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar.gz https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar.gz'
276
+ when:
277
+ steps:
278
+ - name: get_release
279
+ on:
280
+ - success
281
+ - name: archive_win
282
+ on:
283
+ - success
140
284
 
141
- update_documentation:
142
- title: "Update documentation http://cli.codefresh.io"
143
- image: docker:18.01
285
+ upload_alpine:
286
+ stage: github
287
+ title: "Upload alpine executable to github release"
288
+ image: codefresh/build-cli
144
289
  commands:
145
- - "apk update && apk add git nodejs"
146
- - "npm install"
147
- - "echo cleaning previous public dir and recreating worktree"
148
- - "rm -rf public && git worktree prune && git worktree add -B gh-pages public origin/gh-pages"
149
- - "echo Building public docs"
150
- - "npm run build-public-docs"
151
- - "echo Push new docs to gh-pages detached branch"
152
- - 'git config --global user.email "auto-ci@codefresh.io" && git config --global user.name "Automated CI"'
153
- - 'cd public && git add --all && git commit -m "Publish new documentation for version ${{PACKAGE_VERSION}}" && git push https://${{GITHUB_TOKEN}}@github.com/codefresh-io/cli.git'
154
- environment:
155
- - HUGO_VERSION=0.32.0
290
+ # upload alpine-x64 asset
291
+ - 'curl --fail -X POST -H "Content-Type:application/octet-stream" -H "Authorization: token ${{GITHUB_TOKEN}}" --data-binary @codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar.gz https://uploads.github.com/repos/codefresh-io/cli/releases/${{GITHUB_RELEASE_ID}}/assets?name=codefresh-v${{PACKAGE_VERSION}}-alpine-x64.tar.gz'
292
+ when:
293
+ steps:
294
+ - name: get_release
295
+ on:
296
+ - success
297
+ - name: archive_alpine
298
+ on:
299
+ - success
300
+
301
+ deploy_to_npm:
302
+ stage: packages
303
+ title: "Publishing To Npm"
304
+ type: npm-publish
305
+ arguments:
306
+ NPM_TOKEN: '${{NPM_TOKEN}}'
307
+ DIR: ./cli
308
+ when:
309
+ steps:
310
+ - name: generate_comletion
311
+ on:
312
+ - success
313
+
156
314
 
157
315
  update_brew_formula:
316
+ stage: packages
158
317
  title: "Updating homebrew formula"
159
318
  image: codefresh/build-cli
160
319
  commands:
161
320
  - VERSION=v${{PACKAGE_VERSION}}
162
- - curl -L https://github.com/codefresh-io/cli/releases/download/$VERSION/codefresh-$VERSION-macos-x64.tar.gz > $VERSION.tar.gz
321
+ - cp --force codefresh-$VERSION-macos-x64.tar.gz $VERSION.tar.gz
163
322
  - echo "compute SHA256 ..."
164
323
  - SHA256="$(shasum -a 256 ./$VERSION.tar.gz | awk '{print $1}')"
165
324
  - echo "generate file from template ..."
@@ -171,3 +330,48 @@ steps:
171
330
  \"content\": \"$(openssl base64 -A -in codefresh.rb)\", \
172
331
  \"sha\": $(curl -X GET https://api.github.com/repos/codefresh-io/homebrew-cli/contents/Formula/codefresh.rb | jq .sha) \
173
332
  }" https://api.github.com/repos/codefresh-io/homebrew-cli/contents/Formula/codefresh.rb
333
+ when:
334
+ steps:
335
+ - name: archive_macos
336
+ on:
337
+ - success
338
+
339
+ update_documentation:
340
+ stage: documentation
341
+ title: "Update documentation http://cli.codefresh.io"
342
+ image: docker:18.01
343
+ commands:
344
+ - "apk update && apk add git nodejs"
345
+ - "npm install"
346
+ - "echo cleaning previous public dir and recreating worktree"
347
+ - "rm -rf public && git worktree prune && git worktree add -B gh-pages public origin/gh-pages"
348
+ - "echo Building public docs"
349
+ - "npm run build-public-docs"
350
+ - "echo Push new docs to gh-pages detached branch"
351
+ - 'git config --global user.email "auto-ci@codefresh.io" && git config --global user.name "Automated CI"'
352
+ - 'cd public && git add --all && git commit -m "Publish new documentation for version ${{PACKAGE_VERSION}}" && git push https://${{GITHUB_TOKEN}}@github.com/codefresh-io/cli.git'
353
+ environment:
354
+ - HUGO_VERSION=0.32.0
355
+ when:
356
+ steps:
357
+ - name: upload_linux
358
+ on:
359
+ - success
360
+ - name: upload_macos
361
+ on:
362
+ - success
363
+ - name: upload_win
364
+ on:
365
+ - success
366
+ - name: upload_alpine
367
+ on:
368
+ - success
369
+ - name: update_brew_formula
370
+ on:
371
+ - success
372
+ - name: deploy_to_npm
373
+ on:
374
+ - success
375
+ - name: create_manifest_list
376
+ on:
377
+ - success
package/codefresh.yml CHANGED
@@ -10,24 +10,6 @@ steps:
10
10
  revision: ${{CF_BRANCH}}
11
11
  git: cf_github
12
12
 
13
- install_dependencies:
14
- title: 'Installing testing dependencies'
15
- image: codefresh/node-tester-image:10.15.3
16
- commands:
17
- - yarn install --frozen-lockfile
18
-
19
- eslint:
20
- title: 'Running linting logic'
21
- image: codefresh/node-tester-image:10.15.3
22
- commands:
23
- - yarn eslint
24
-
25
- unit-tests:
26
- title: 'Running unit tests'
27
- image: codefresh/node-tester-image:10.15.3
28
- commands:
29
- - yarn test
30
-
31
13
  extract_version:
32
14
  title: "Exporting package.json version"
33
15
  image: codefresh/build-cli
@@ -36,6 +18,57 @@ steps:
36
18
  - "echo Current version: $PACKAGE_VERSION"
37
19
  - "cf_export PACKAGE_VERSION"
38
20
 
21
+ check_version:
22
+ title: 'Checking if version already exists'
23
+ image: codefresh/build-cli
24
+ fail_fast: false
25
+ commands:
26
+ - >-
27
+ RELEASE_ID="$(curl -s https://api.github.com/repos/codefresh-io/cli/releases/tags/v${{PACKAGE_VERSION}} | jq .id)"
28
+ echo "Release id: $RELEASE_ID"
29
+
30
+ if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = 'null' ]; then
31
+ echo "Version is ok: ${{PACKAGE_VERSION}}"
32
+ else
33
+ echo "Release already exists ${{PACKAGE_VERSION}}"
34
+ exit 1
35
+ fi
36
+ when:
37
+ condition:
38
+ all:
39
+ skipVersionCheck: '"${{SKIP_VERSION_CHECK}}" != "true"'
40
+
41
+ install_dependencies:
42
+ title: 'Installing testing dependencies'
43
+ image: codefresh/build-cli
44
+ commands:
45
+ - yarn install --frozen-lockfile
46
+
47
+ parallel_tests:
48
+ type: parallel
49
+ steps:
50
+ eslint:
51
+ title: 'Running linting logic'
52
+ image: codefresh/build-cli
53
+ commands:
54
+ - yarn eslint
55
+
56
+ unit_tests:
57
+ title: 'Running unit tests'
58
+ image: codefresh/build-cli
59
+ commands:
60
+ - yarn test
61
+
62
+ e2e_tests:
63
+ title: 'Running e2e tests'
64
+ image: codefresh/build-cli
65
+ commands:
66
+ - "echo Running e2e on account: ${{CF_ACCOUNT}}"
67
+ - CF_API_KEY=${{CF_E2E_API_KEY}} yarn e2e
68
+ when:
69
+ branch:
70
+ ignore: [ master ]
71
+
39
72
  build_images:
40
73
  type: parallel
41
74
  steps:
@@ -49,7 +82,7 @@ steps:
49
82
  run_arm_build:
50
83
  type: codefresh-run
51
84
  arguments:
52
- PIPELINE_ID: 'codefresh-io/cli/build-arm'
85
+ PIPELINE_ID: codefresh-io/cli/build-arm
53
86
  TRIGGER_ID: codefresh-io/cli
54
87
  BRANCH: ${{CF_BRANCH}}
55
88
  DETACH: false
@@ -105,9 +138,17 @@ steps:
105
138
  tags:
106
139
  - ${{CF_SHORT_REVISION}}
107
140
 
141
+ fail_on_bad_version:
142
+ image: codefresh/build-cli
143
+ commands:
144
+ - exit 1
145
+ when:
146
+ condition:
147
+ all:
148
+ versionCheckFailed: steps.check_version.result == 'failure'
149
+
108
150
  execute_release_pipeline:
109
151
  title: "Execute release pipeline in case version was changed"
110
- fail_fast: false
111
152
  type: codefresh-run
112
153
  arguments:
113
154
  PIPELINE_ID: 'codefresh-io/cli/release'
@@ -118,3 +159,6 @@ steps:
118
159
  when:
119
160
  branch:
120
161
  only: [ master ]
162
+ condition:
163
+ all:
164
+ versionCheckSucceeded: steps.check_version.result != 'failure'
package/e2e/README.md ADDED
@@ -0,0 +1,10 @@
1
+ # Codefresh Cli E2E
2
+
3
+ Account -- codefresh-cli-e2e
4
+
5
+ If you want to debug e2e:
6
+ 1) enable debug on the `build` pipeline
7
+ 2) put breakpoint after `e2e_tests` step
8
+ 3) then you can see logs of each test under `/codefresh/volume/cli/e2e/scenarios`
9
+
10
+ ##### Note: try to create projects that do not contain same words (like _cli-e2e_ and _cli-e2e_-test)
@@ -0,0 +1,23 @@
1
+ version: '1.0'
2
+ kind: pipeline
3
+ metadata:
4
+ name: pipeline-crud/crud
5
+ project: pipeline-crud
6
+ originalYamlString: |
7
+ version: '1.0'
8
+ steps:
9
+ test:
10
+ image: alpine
11
+ commands:
12
+ - echo test
13
+ spec:
14
+ triggers: []
15
+ stages: []
16
+ variables: []
17
+ contexts: []
18
+ steps:
19
+ test:
20
+ image: alpine
21
+ commands:
22
+ - echo test
23
+
@@ -0,0 +1,23 @@
1
+ version: '1.0'
2
+ kind: pipeline
3
+ metadata:
4
+ name: test-run/test-run
5
+ project: test-run
6
+ originalYamlString: |
7
+ version: '1.0'
8
+ steps:
9
+ test:
10
+ image: alpine
11
+ commands:
12
+ - echo test
13
+ spec:
14
+ triggers: []
15
+ stages: []
16
+ variables: []
17
+ contexts: []
18
+ steps:
19
+ test:
20
+ image: alpine
21
+ commands:
22
+ - echo test
23
+
@@ -0,0 +1,25 @@
1
+ # fail if one of the commands returns non-zero code
2
+ set -e
3
+ set -o pipefail
4
+
5
+ export SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
6
+ source "$SCRIPT_DIR/helpers.sh"
7
+
8
+ codefresh version
9
+ echo
10
+
11
+ for executable in $SCRIPT_DIR/scenarios/*.sh
12
+ do
13
+ source $executable > "$executable.log" 2>&1 &
14
+ echo "[$!] Executing: $executable"
15
+ done
16
+ echo
17
+
18
+ for job in `jobs -p`
19
+ do
20
+ echo "Waiting for $job..."
21
+ wait $job || exit 1
22
+ done
23
+
24
+ echo
25
+ echo "All tests executed successfully!"
package/e2e/helpers.sh ADDED
@@ -0,0 +1,10 @@
1
+ CODEFRESH_PATH="$SCRIPT_DIR/../lib/interface/cli/codefresh"
2
+
3
+ echo "Using $CODEFRESH_PATH"
4
+ function codefresh() {
5
+ $CODEFRESH_PATH $@
6
+ }
7
+
8
+ function exists() {
9
+ codefresh get $1 | grep $2 || echo ''
10
+ }
@@ -0,0 +1 @@
1
+ codefresh get agents
@@ -0,0 +1,2 @@
1
+ echo "Skipping annotation.sh"
2
+ #codefresh get annotation
@@ -0,0 +1,3 @@
1
+ codefresh get boards
2
+ echo "Skipping sections.sh"
3
+ #codefresh get sections
@@ -0,0 +1 @@
1
+ codefresh get builds
@@ -0,0 +1 @@
1
+ codefresh get clusters
@@ -0,0 +1 @@
1
+ codefresh get compositions
@@ -0,0 +1 @@
1
+ codefresh get contexts