@@ -13,20 +13,18 @@ test:
1313 script : |
1414 #!/usr/bin/env bash
1515 # Download and configure golang
16- wget --header "Accept: application/octet-stream" "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
17- rm -rf /usr/local/go && tar -C /usr/local -xf go1.16.linux-amd64.tar.gz
16+ GO_VERSION=$(get_env go-version)
17+ wget --header "Accept: application/octet-stream" "https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz"
18+ rm -rf /usr/local/go && tar -C /usr/local -xf go*.linux-amd64.tar.gz
1819 export PATH=$PATH:/usr/local/go/bin
1920 apt-get update
20- apt-get -y install build-essential
21- # Run unit tests
22- #export DOCKER_USERNAME=$(get_env docker-username)
23- #export DOCKER_PASSWORD=$(get_env docker-password)
21+ apt-get -y install build-essential
22+
2423 make unit-test
25- #make docker-login
26- #make build-image
2724
2825static-scan :
2926 dind : true
27+ abort_on_failure : false
3028 image : icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
3129 script : |
3230 #!/usr/bin/env bash
@@ -47,7 +45,9 @@ static-scan:
4745 EOF
4846 chmod -x "$WORKSPACE"/runtime-component-operator/sonar-project.properties
4947 #echo "$SONAR_PASS" >> /tmp/sonarqube-token
50- "${ONE_PIPELINE_PATH}"/internal/sonarqube/sonarqube_run
48+ "${COMMONS_PATH}"/static-scan/run.sh
49+ ## Perform static lint
50+ ./scripts/pipeline/static-linter-scan.sh --git-token $(get_env git-token) --static-linter-version $(get_env static-linter-version)
5151containerize :
5252 dind : true
5353 abort_on_failure : true
@@ -79,7 +79,7 @@ containerize:
7979 fi
8080 # Build images
8181 export PIPELINE_USERNAME=$(get_env ibmcloud-api-user)
82- export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key)
82+ export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key-staging )
8383 PIPELINE_REGISTRY=$(get_env pipeline-registry)
8484 PIPELINE_OPERATOR_IMAGE=$(get_env pipeline-operator-image)
8585 # Build amd64 image
@@ -111,6 +111,13 @@ containerize:
111111 save_artifact $i type=image name="$IMAGE" "digest=$DIGEST" "arch=$ARCH"
112112 done
113113
114+ sign-artifact :
115+ abort_on_failure : false
116+ image : icr.io/continuous-delivery/pipeline/image-signing:1.0.0@sha256:e9d8e354668ba3d40be2aaee08298d2aa7f0e1c8a1829cca4094ec93830e3e6a
117+ script : |
118+ #!/usr/bin/env bash
119+ echo "sign-artifact"
120+
114121deploy :
115122 image : icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
116123 script : |
@@ -129,10 +136,6 @@ dynamic-scan:
129136 script : |
130137 #!/usr/bin/env bash
131138 echo "dynamic-scan"
132- #export APP_URL=$(cat ../app-url)
133- # feature preivew this until evidence locker v2 usage is full feature ready
134- # can be triggered, and owasp will run for preview purposes
135- #source scripts/zap/trigger_api_scan.sh
136139
137140acceptance-test :
138141 dind : true
@@ -141,21 +144,27 @@ acceptance-test:
141144 script : |
142145 #!/usr/bin/env bash
143146 echo "acceptance-test"
144- # Download and configure golang
145- wget --header "Accept: application/octet-stream" "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
146- rm -rf /usr/local/go && tar -C /usr/local -xf go1.16.linux-amd64.tar.gz
147- export PATH=$PATH:/usr/local/go/bin
148- apt-get update
149- apt-get -y install build-essential
150- export PIPELINE_USERNAME=$(get_env ibmcloud-api-user)
151- export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key)
152- export DOCKER_USERNAME=$(get_env docker-username)
153- export DOCKER_PASSWORD=$(get_env docker-password)
154- export CLUSTER_URL=$(get_env test-cluster-url)
155- export CLUSTER_TOKEN=$(get_env test-cluster-token)
156- export TRAVIS_BUILD_NUMBER=$BUILD_NUMBER
157- make setup
158- make test-pipeline-e2e
147+ GO_VERSION=$(get_env go-version)
148+ export SKIP_KIND_E2E_TEST=$(get_env SKIP_KIND_E2E_TEST)
149+ if [[ $SKIP_KIND_E2E_TEST != "true" ]]; then
150+ # Download and configure golang
151+ wget --header "Accept: application/octet-stream" "https://golang.org/dl/go$GO_VERSION.linux-amd64.tar.gz"
152+ rm -rf /usr/local/go && tar -C /usr/local -xf go1.16.linux-amd64.tar.gz
153+ export PATH=$PATH:/usr/local/go/bin
154+ apt-get update
155+ apt-get -y install build-essential
156+ export PIPELINE_USERNAME=$(get_env ibmcloud-api-user)
157+ export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key-staging)
158+ export DOCKER_USERNAME=$(get_env docker-username)
159+ export DOCKER_PASSWORD=$(get_env docker-password)
160+ export CLUSTER_URL=$(get_env test-cluster-url)
161+ export CLUSTER_TOKEN=$(get_env test-cluster-token)
162+ export TRAVIS_BUILD_NUMBER=$BUILD_NUMBER
163+ make setup
164+ make test-pipeline-e2e
165+ else
166+ echo "skipping Acceptance test"
167+ fi
159168
160169scan-artifact :
161170 abort_on_failure : false
@@ -181,25 +190,64 @@ scan-artifact:
181190 done
182191 fi
183192
193+ echo "aqua scan"
194+ # install docker
195+ curl -fsSL https://get.docker.com -o get-docker.sh
196+ sudo sh get-docker.sh
197+ # get aqua scan executables
198+ git clone https://$(get_env git-token)@github.ibm.com/CICD-CPP/cpp-pipelines.git
199+ chmod -R +x cpp-pipelines
200+ # setup and execute aqua scan
201+ cd cpp-pipelines
202+ export CUSTOM_SCRIPTS_PATH=/workspace/app/one-pipeline-config-repo/cpp-pipelines
203+ ./commons/aqua/aqua-local-scan
204+
205+ source "${COMMONS_PATH}/whitesource/whitesource_unified_agent_scan.sh"
206+
184207release :
185208 abort_on_failure : false
186- image : wcp-compliance-automation-team-docker-local.artifactory.swg-devops.com/ibm-compliance-automation:1.9.1 @sha256:3f3e344a1efb160d83c48cf2ee878a39cbad058c8640c423472e0546316232fd
209+ image : icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12 @sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
187210 script : |
188211 #!/usr/bin/env bash
189- echo "release"
190- set_env ibmcloud-api-key $(get_env ibmcloud-api-key-prod)
191-
192- # owasp-zap-api:
193- # dind: true
194- # abort_on_failure: false
195- # image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
196- # script: |
197- # !/usr/bin/env bash
198- # if [[ "$PIPELINE_DEBUG" == 1 ]]; then
199- # trap env EXIT
200- # env
201- # set -x
202- # fi
203-
204- # source scripts/zap/setup_api_scan.sh
205- # source scripts/zap/run_api_scan.sh
212+
213+ RELEASE_FLAG=$(get_env release "false")
214+
215+ if [[ $RELEASE_FLAG != "true" ]]; then
216+ echo "Skipping release stage; environment property 'release' is set to $RELEASE_FLAG"
217+ exit 0
218+ fi
219+
220+ SKIP_ALL_CHECKS=$(get_env SKIP_ALL_CHECKS "false")
221+ ./scripts/pipeline/evaluator.sh
222+ if [[ $? == 0 || $SKIP_ALL_CHECKS == "true" ]]; then
223+ if [[ $SKIP_ALL_CHECKS == "true" ]]; then
224+ echo "Skipping image scan checks"
225+ fi
226+ APP_REPO=$(pwd)
227+ echo "Application Repository: $APP_REPO"
228+ INVENTORY_REPO=$(get_env inventory-repo)
229+ echo "Cloning inventory repository: $INVENTORY_REPO"
230+ cd "$WORKSPACE"
231+ APP_TOKEN_PATH="$WORKSPACE/secrets/app-token"
232+ . "${ONE_PIPELINE_PATH}"/git/clone_repo \
233+ "$INVENTORY_REPO" \
234+ "master" \
235+ "" \
236+ "$APP_TOKEN_PATH"
237+ REPO=${INVENTORY_REPO##*/}
238+ NAME=${REPO%.*}
239+ echo "Inventory name: $NAME"
240+ cd $WORKSPACE/$NAME
241+ if [ "$(ls )" ]; then
242+ echo "Clearing inventory repository: $INVENTORY_REPO"
243+ git config --global user.email "tekton@example.com"
244+ git config --global user.name "Tekton"
245+ git rm *
246+ git commit -m "Delete contents of inventory repository - $PIPELINE_RUN_ID"
247+ git push origin master
248+ fi
249+ cd $APP_REPO
250+ ./scripts/pipeline/release.sh
251+ else
252+ echo "Errors found. images will not be released"
253+ fi
0 commit comments