Skip to content

Commit 7dda2b6

Browse files
authored
Merge pull request #3 from simplify-framework/feature/upgrade-docker-run-scripts
Fix merging objects - deep merge varialbes, stages, extends
2 parents 518c7b7 + 9b88cde commit 7dda2b6

File tree

6 files changed

+259
-72
lines changed

6 files changed

+259
-72
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
**/*
21
!README.md
32
!.gitignore
43
!.github

.gitlab-ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
image: node:lts-stretch
3+
stages:
4+
- build
5+
- test
6+
7+
include:
8+
- local: Security/SAST.gitlab-ci.yml
9+
- template: Security/DAST.gitlab-ci.yml
10+
11+
package-build:
12+
stage: build
13+
before_script:
14+
- mkdir -p /root/.aws/
15+
- echo "[default]" > /root/.aws/credentials
16+
- echo "[default]" > /root/.aws/config
17+
script:
18+
- echo "TEST_FILE_CREAED-1" >> test-file.json
19+
20+
package-test:
21+
stage: test
22+
dependencies:
23+
- package-build
24+
script:
25+
- ls -la && cat test-file.json
26+
- cat .gitlab-ci.yml

Security/SAST.gitlab-ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Read more about this feature here: https://docs.gitlab.com/ee/user/application_security/sast/
2+
#
3+
# Configure the scanning tool through the environment variables.
4+
# List of the variables: https://gitlab.com/gitlab-org/security-products/sast#settings
5+
# How to set: https://docs.gitlab.com/ee/ci/yaml/#variables
6+
7+
variables:
8+
# Setting this variable will affect all Security templates
9+
# (SAST, Dependency Scanning, ...)
10+
SECURE_ANALYZERS_PREFIX: "registry.gitlab.com/gitlab-org/security-products/analyzers"
11+
SAST_DEFAULT_ANALYZERS: "nodejs-scan, eslint, mobsf, semgrep"
12+
SAST_EXCLUDED_ANALYZERS: ""
13+
SAST_EXCLUDED_PATHS: "spec, test, tests, tmp"
14+
SAST_ANALYZER_IMAGE_TAG: 2
15+
SCAN_KUBERNETES_MANIFESTS: "false"
16+
17+
sast:
18+
stage: test
19+
artifacts:
20+
paths:
21+
- gl-sast-report.json
22+
reports:
23+
sast: gl-sast-report.json
24+
rules:
25+
- when: never
26+
variables:
27+
SEARCH_MAX_DEPTH: 4
28+
script:
29+
- echo "$CI_JOB_NAME is used for configuration only, and its script should not be executed"
30+
- exit 1
31+
32+
.sast-analyzer:
33+
extends: sast
34+
allow_failure: false
35+
# `rules` must be overridden explicitly by each child job
36+
# see https://gitlab.com/gitlab-org/gitlab/-/issues/218444
37+
script:
38+
- /analyzer run
39+
- if [ "`which node | grep '/bin/node$'`" == "" ]; then apk add nodejs npm; fi
40+
- if [ "$SAST_FAILURE_ALLOWED" == "false" ]; then npm install simplify-security; fi
41+
- if [ "$SAST_FAILURE_ALLOWED" == "false" ]; then node node_modules/simplify-security/entrypoint.js report -i gl-sast-report.json; fi
42+
43+
eslint-sast:
44+
extends: .sast-analyzer
45+
image:
46+
name: "$SAST_ANALYZER_IMAGE"
47+
variables:
48+
# SAST_ANALYZER_IMAGE is an undocumented variable used internally to allow QA to
49+
# override the analyzer image with a custom value. This may be subject to change or
50+
# breakage across GitLab releases.
51+
SAST_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/eslint:$SAST_ANALYZER_IMAGE_TAG"
52+
SAST_FAILURE_ALLOWED: "$ESLINT_FAILURE_ALLOWED"
53+
rules:
54+
- if: $SAST_DISABLED
55+
when: never
56+
- if: $SAST_EXCLUDED_ANALYZERS =~ /eslint/
57+
when: never
58+
- if: $CI_COMMIT_BRANCH &&
59+
$SAST_DEFAULT_ANALYZERS =~ /eslint/
60+
exists:
61+
- '**/*.html'
62+
- '**/*.js'
63+
- '**/*.jsx'
64+
- '**/*.ts'
65+
- '**/*.tsx'

0 commit comments

Comments
 (0)