3
3
# # SPDX-License-Identifier: LicenseRef-Splunk-1-2020
4
4
# #
5
5
# #
6
-
6
+ # jscpd:ignore-start
7
7
version : 2.1
8
8
orbs :
9
9
@@ -12,26 +12,44 @@ orbs:
12
12
package :
13
13
docker :
14
14
- image : circleci/buildpack-deps:stable
15
- resource_class : large
15
+ resource_class : small
16
16
steps :
17
17
- checkout
18
18
- run :
19
19
name : Setup Environment
20
20
command : |
21
21
sudo apt-get update
22
22
sudo apt-get install -y python2 python-pip python-virtualenv python3 python3.7 python3-pip python3-virtualenv
23
+ sudo pip3 install poetry
23
24
python3.7 -m virtualenv ~/.venv -p python3
24
25
source ~/.venv/bin/activate
25
26
pip install pip --upgrade
27
+ if [ -f "poetry.lock" ]
28
+ then
29
+ mkdir -p package/lib || true
30
+ poetry export --without-hashes -o package/lib/requirements.txt
31
+ poetry export --without-hashes --dev -o requirements_dev.txt
32
+ fi
26
33
pip install -r requirements_dev.txt --use-deprecated=legacy-resolver || true
27
34
pip install semantic_version==2.6.0
28
35
sudo apt install npm
36
+ if [ -f "yarn.lock" ]
37
+ then
38
+ sudo npm install --global yarn
39
+ yarn
40
+ fi
41
+
29
42
- run :
30
43
name : Generate Addon
31
44
command : |
32
45
touch nextRelease.txt
33
- npx -p @semantic-release/exec -p semantic-release semantic-release --dry-run --plugins "@semantic-release/commit-analyzer,@semantic-release/exec" --analyzeCommits @semantic-release/commit-analyzer --verifyRelease @semantic-release/exec --verifyReleaseCmd 'echo ${nextRelease.version} > nextRelease.txt'
34
- sed -i "s/-develop./develop/g" nextRelease.txt
46
+ npx -p @semantic-release/exec -p [email protected] -p semantic-release/git -p semantic-release/github \
47
+ semantic-release --dry-run \
48
+ --plugins "@semantic-release/commit-analyzer,@semantic-release/exec,@semantic-release/git,@semantic-release/github" \
49
+ --analyzeCommits @semantic-release/commit-analyzer \
50
+ --verifyRelease @semantic-release/exec \
51
+ --verifyReleaseCmd 'echo ${nextRelease.version} > nextRelease.txt'
52
+ sed -i "s/-beta./b/g" nextRelease.txt
35
53
VERSION=$(cat nextRelease.txt)
36
54
echo VERSION="$VERSION"
37
55
echo CIRCLE_TAG=$CIRCLE_TAG
@@ -43,13 +61,16 @@ orbs:
43
61
CIRCLE_TAG=${CIRCLE_TAG:1}
44
62
echo CIRCLE_TAG=$CIRCLE_TAG
45
63
ucc-gen --ta-version="$CIRCLE_TAG"
46
- fi
64
+ fi
65
+ if [ -f "yarn.lock" ]
66
+ then
67
+ yarn run build
68
+ fi
47
69
- run :
48
70
name : Generating package
49
71
command : |
50
72
PACKAGE_ID=$(ls output/)
51
73
BUILD_DIR=output/$PACKAGE_ID
52
- rm -rf $BUILD_DIR/lib/aiohttp/.hash || true
53
74
find $BUILD_DIR/lib -executable -type f -exec chmod -x {} \; 2>/dev/null || true
54
75
source ~/.venv/bin/activate
55
76
slim generate-manifest $BUILD_DIR --update >/tmp/app.manifest || true
@@ -136,6 +157,8 @@ jobs:
136
157
default : test
137
158
docker :
138
159
- image : circleci/python:3.7
160
+ resource_class : small
161
+
139
162
steps :
140
163
- checkout
141
164
- attach_workspace :
@@ -145,7 +168,7 @@ jobs:
145
168
command : |
146
169
python -m venv ~/.venv
147
170
source ~/.venv/bin/activate
148
- pip install https://download. splunk.com/misc/appinspect/splunk -appinspect-latest.tar.gz
171
+ pip install splunk-appinspect
149
172
- run :
150
173
name : inspect
151
174
command : |
@@ -164,43 +187,43 @@ jobs:
164
187
cat test-results/$CIRCLE_PROJECT_REPONAME-appinspect-mode-<<parameters.label>>.xml | sed 's/<skipped\/>//g' | sed 's/skipped[^ ]*/skipped=\"0\"/g' >/tmp/$CIRCLE_PROJECT_REPONAME-appinspect-mode-<<parameters.label>>.xml
165
188
zip -j /tmp/$CIRCLE_PROJECT_REPONAME-appinspect-mode-<<parameters.label>>.zip /tmp/$CIRCLE_PROJECT_REPONAME-appinspect-mode-<<parameters.label>>.xml
166
189
167
- LUUID=$(curl -X POST "$RP_ENDPOINT/api/v1/addonfactory/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "Authorization: bearer $RP_UUID" -F "file=@/tmp/$CIRCLE_PROJECT_REPONAME-appinspect-mode-<<parameters.label>>.zip;type=application/zip" 2>/dev/null | sed 's/\(.*id = \)\([^ ]*\)\(.*\)/\2/')
168
- echo LUUID=$LUUID
169
- LID=$(curl -X GET "$RP_ENDPOINT/api/v1/addonfactory/launch/uuid/$LUUID" -H "accept: */*" -H "Authorization: bearer $RP_UUID" 2>/dev/null| jq .id)
170
- echo LID=$LID
171
- APPINSPECTVER=$(splunk-appinspect list version | sed 's/\(.*Version \)\(.*\)/\2/')
172
- UPDATE="
173
- { \"attributes\":
174
- [
175
- { \"key\": \"job\",
176
- \"value\": \"${CIRCLE_JOB}\"
177
- },
178
- { \"key\": \"appinspect\",
179
- \"value\": \"$APPINSPECTVER\"
180
- },
181
- { \"key\": \"branch\",
182
- \"value\": \"<< pipeline.git.branch >>\"
183
- },
184
- { \"key\": \"commit\",
185
- \"value\": \"${CIRCLE_SHA1}\"
186
- },
187
- { \"key\": \"release\",
188
- \"value\": \"${RELEASE}\"
189
- },
190
- { \"key\": \"version\",
191
- \"value\": \"$(./semtag getcurrent)\"
192
- },
193
- { \"key\": \"repo\",
194
- \"value\": \"$CIRCLE_PROJECT_REPONAME\"
195
- }
196
- ]
197
- }"
198
- echo $UPDATE | jq
199
- curl -X PUT "$RP_ENDPOINT/api/v1/addonfactory/launch/$LID/update" \
200
- -H "accept: */*" \
201
- -H "Content-Type: application/json" \
202
- -H "Authorization: bearer $RP_UUID" \
203
- -d "$UPDATE"
190
+ # LUUID=$(curl -X POST "$RP_ENDPOINT/api/v1/addonfactory/launch/import" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "Authorization: bearer $RP_UUID" -F "file=@/tmp/$CIRCLE_PROJECT_REPONAME-appinspect-mode-<<parameters.label>>.zip;type=application/zip" 2>/dev/null | sed 's/\(.*id = \)\([^ ]*\)\(.*\)/\2/')
191
+ # echo LUUID=$LUUID
192
+ # LID=$(curl -X GET "$RP_ENDPOINT/api/v1/addonfactory/launch/uuid/$LUUID" -H "accept: */*" -H "Authorization: bearer $RP_UUID" 2>/dev/null| jq .id)
193
+ # echo LID=$LID
194
+ # APPINSPECTVER=$(splunk-appinspect list version | sed 's/\(.*Version \)\(.*\)/\2/')
195
+ # UPDATE="
196
+ # { \"attributes\":
197
+ # [
198
+ # { \"key\": \"job\",
199
+ # \"value\": \"${CIRCLE_JOB}\"
200
+ # },
201
+ # { \"key\": \"appinspect\",
202
+ # \"value\": \"$APPINSPECTVER\"
203
+ # },
204
+ # { \"key\": \"branch\",
205
+ # \"value\": \"<< pipeline.git.branch >>\"
206
+ # },
207
+ # { \"key\": \"commit\",
208
+ # \"value\": \"${CIRCLE_SHA1}\"
209
+ # },
210
+ # { \"key\": \"release\",
211
+ # \"value\": \"${RELEASE}\"
212
+ # },
213
+ # { \"key\": \"version\",
214
+ # \"value\": \"$(./semtag getcurrent)\"
215
+ # },
216
+ # { \"key\": \"repo\",
217
+ # \"value\": \"$CIRCLE_PROJECT_REPONAME\"
218
+ # }
219
+ # ]
220
+ # }"
221
+ # echo $UPDATE | jq
222
+ # curl -X PUT "$RP_ENDPOINT/api/v1/addonfactory/launch/$LID/update" \
223
+ # -H "accept: */*" \
224
+ # -H "Content-Type: application/json" \
225
+ # -H "Authorization: bearer $RP_UUID" \
226
+ # -d "$UPDATE"
204
227
- run :
205
228
name : set result
206
229
command : |
@@ -224,9 +247,13 @@ jobs:
224
247
description : sc4s version
225
248
type : string
226
249
default : latest
250
+ resource_class :
251
+ description : Docker CicreCi machine size
252
+ type : string
253
+ default : large
227
254
docker :
228
255
- image : circleci/python:3.7
229
- resource_class : xlarge
256
+ resource_class : <<parameters.resource_class>>
230
257
steps :
231
258
- checkout
232
259
- run : git submodule sync
@@ -249,6 +276,16 @@ jobs:
249
276
ls
250
277
rm *.tar.gz
251
278
ls
279
+ - run :
280
+ name : generate requirements
281
+ command : |
282
+ if [ -f "poetry.lock" ]
283
+ then
284
+ mkdir -p package/lib || true
285
+ pip install poetry
286
+ poetry export --without-hashes -o package/lib/requirements.txt
287
+ poetry export --without-hashes --dev -o requirements_dev.txt
288
+ fi
252
289
- run :
253
290
name : Splunk Testing
254
291
no_output_timeout : 2h
@@ -289,6 +326,11 @@ jobs:
289
326
# Saucelab connection
290
327
[ -z $BROWSER ] || [ "$UI_TEST_HEADLESS" = "true" ] || docker-compose -f docker-compose-ci.yml up -d sauceconnect
291
328
329
+ # Start selenium grid if needed.
330
+ if [[ "<<parameters.test_set>>" == *"firefox_grid"* ]]; then docker-compose -f docker-compose-ci.yml up -d firefox-grid; fi
331
+ if [[ "<<parameters.test_set>>" == *"chrome_grid"* ]]; then docker-compose -f docker-compose-ci.yml up -d chrome-grid; fi
332
+
333
+
292
334
# Start Splunk
293
335
docker-compose -f docker-compose-ci.yml up -d splunk
294
336
until docker-compose -f docker-compose-ci.yml logs splunk | grep "Ansible playbook complete" ; do sleep 1; done
@@ -339,7 +381,7 @@ jobs:
339
381
default : py3-3.7.8
340
382
docker :
341
383
- image : circleci/python:3.7
342
- resource_class : xlarge
384
+ resource_class : small
343
385
steps :
344
386
- checkout
345
387
- run : git submodule sync
@@ -362,6 +404,16 @@ jobs:
362
404
ls
363
405
rm *.tar.gz
364
406
ls
407
+ - run :
408
+ name : generate requirements
409
+ command : |
410
+ if [ -f "poetry.lock" ]
411
+ then
412
+ mkdir -p package/lib || true
413
+ pip install poetry
414
+ poetry export --without-hashes -o package/lib/requirements.txt
415
+ poetry export --without-hashes --dev -o requirements_dev.txt
416
+ fi
365
417
- run :
366
418
name : Splunk Testing
367
419
no_output_timeout : 2h
@@ -406,11 +458,12 @@ jobs:
406
458
407
459
semgrep :
408
460
environment :
409
- SEMGREP_REPO_URL : << pipeline.project.git_url >>
410
- SEMGREP_BRANCH : << pipeline.git.branch >>
461
+ SEMGREP_REPO_URL : << pipeline.project.git_url >>
462
+ SEMGREP_BRANCH : << pipeline.git.branch >>
411
463
docker :
412
464
- image : returntocorp/semgrep-agent:v1
413
465
user : root
466
+ resource_class : medium
414
467
steps :
415
468
- checkout
416
469
- run :
@@ -444,7 +497,7 @@ jobs:
444
497
445
498
release :
446
499
docker :
447
- - image : circleci/node:14
500
+ - image : circleci/node:12
448
501
steps :
449
502
- setup_remote_docker :
450
503
docker_layer_caching : true
@@ -454,8 +507,8 @@ jobs:
454
507
- run :
455
508
name : " Apply Release Tag"
456
509
command : |
457
- npx semantic-release
458
-
510
+ npx -p @ semantic-release/exec -p [email protected] -p semantic-release/git -p semantic-release/github \
511
+ semantic-release
459
512
publish-gh :
460
513
docker :
461
514
- image : circleci/python:3.7
@@ -474,7 +527,6 @@ jobs:
474
527
$HOME/go/bin/ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace "<< pipeline.git.tag >>" /tmp/workspace/build/package/splunkbase
475
528
$HOME/go/bin/ghr -t ${GH_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace "<< pipeline.git.tag >>" /tmp/workspace/build/package/deployment
476
529
477
-
478
530
publish-sbase :
479
531
docker :
480
532
- image : circleci/python:3.7
@@ -500,6 +552,7 @@ jobs:
500
552
reuse :
501
553
docker :
502
554
- image : circleci/python:3.7
555
+ resource_class : small
503
556
steps :
504
557
- setup_remote_docker :
505
558
docker_layer_caching : true
@@ -555,9 +608,10 @@ workflows:
555
608
matrix :
556
609
alias : splunk-app-test-knowledge
557
610
parameters :
558
- splunk_version : ["8.1", "8.2"]
611
+ splunk_version : ["8.0", "8.2"]
559
612
sc4s_version : ["1"]
560
613
test_set : ["knowledge"]
614
+ resource_class : ["medium"]
561
615
filters :
562
616
branches :
563
617
only : /.*/
@@ -570,9 +624,10 @@ workflows:
570
624
matrix :
571
625
alias : splunk-app-test-ui
572
626
parameters :
573
- splunk_version : ["8.1", "8.2"]
627
+ splunk_version : ["8.0", "8.2"]
574
628
sc4s_version : ["1"]
575
629
test_set : ["ui-chrome"]
630
+ resource_class : ["medium"]
576
631
filters :
577
632
branches :
578
633
only : /.*/
@@ -584,9 +639,10 @@ workflows:
584
639
matrix :
585
640
alias : splunk-app-test-modinput
586
641
parameters :
587
- splunk_version : ["8.1", "8.2"]
642
+ splunk_version : ["8.0", "8.2"]
588
643
sc4s_version : ["1"]
589
644
test_set : ["modinput_functional", "modinput_others"]
645
+ resource_class : ["large"]
590
646
filters :
591
647
branches :
592
648
only : /.*/
@@ -601,7 +657,7 @@ workflows:
601
657
test_set : ["py3-3.7.4", "py3-3.7.8"]
602
658
filters :
603
659
branches :
604
- only : /.*/
660
+ only : /.*/
605
661
- approval-release :
606
662
requires :
607
663
- package
@@ -652,3 +708,4 @@ workflows:
652
708
ignore : /.*/
653
709
tags :
654
710
only : /^v\d*\.\d*\.\d*$/
711
+ # jscpd:ignore-end
0 commit comments