Skip to content

Commit be098b8

Browse files
authored
Build and pipeline updates (#470)
* Update pipeline * Build only amd64
1 parent a68002e commit be098b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+8497
-111
lines changed

.one-pipeline.yaml

Lines changed: 123 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
version: '1'
22

33
setup:
4-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
4+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
55
script: |
66
#!/usr/bin/env bash
77
88
echo "setup"
9-
apt-get update
10-
apt-get -y install build-essential
119
1210
# Download Go
1311
GO_VERSION=$(get_env go-version)
@@ -55,11 +53,11 @@ setup:
5553
echo "git push --prune https://$GHE_TOKEN@$WHITESOURCE_GHE_REPO $BRANCH_REFSPEC +refs/tags/*:refs/tags/*"
5654
git push --prune https://$GHE_TOKEN@$WHITESOURCE_GHE_REPO $BRANCH_REFSPEC +refs/tags/*:refs/tags/*
5755
fi
58-
56+
5957
test:
6058
dind: true
6159
abort_on_failure: true
62-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
60+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
6361
script: |
6462
#!/usr/bin/env bash
6563
@@ -89,17 +87,19 @@ test:
8987
static-scan:
9088
dind: true
9189
abort_on_failure: false
92-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
90+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
9391
script: |
9492
#!/usr/bin/env bash
93+
9594
PERIODIC_SCAN=$(get_env periodic-rescan)
9695
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
9796
9897
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
99-
echo "Skipping static scan. This is a periodic run that is only meant to produce CVE information."
98+
echo "Skipping static-scan. This is a periodic run that is only meant to produce CVE information."
10099
exit 0
101100
fi
102101
102+
BRANCH=$(get_env branch)
103103
read -r SONAR_HOST_URL <<< "$(get_env sonarqube | jq -r '.parameters.dashboard_url' | sed 's:/*$::')"
104104
read -r SONAR_USER <<< "$(get_env sonarqube | jq -r '.parameters.user_login')"
105105
SONARQUBE_INSTANCE_ID=$(get_env sonarqube | jq -r '.instance_id')
@@ -109,6 +109,7 @@ static-scan:
109109
sonar.projectKey=runtime-component-operator
110110
sonar.host.url=$SONAR_HOST_URL
111111
sonar.sources=.
112+
sonar.branch.name=$BRANCH
112113
sonar.login=$SONAR_USER
113114
sonar.password=$SONAR_PASS
114115
sonar.c.file.suffixes=-
@@ -118,6 +119,7 @@ static-scan:
118119
chmod -x "$WORKSPACE"/runtime-component-operator/sonar-project.properties
119120
#echo "$SONAR_PASS" >> /tmp/sonarqube-token
120121
"${COMMONS_PATH}"/static-scan/run.sh
122+
121123
## Perform static lint
122124
./scripts/pipeline/static-linter-scan.sh --git-token $(get_env git-token) --static-linter-version $(get_env static-linter-version)
123125
@@ -152,25 +154,19 @@ containerize:
152154
export PIPELINE_USERNAME=$(get_env ibmcloud-api-user)
153155
export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key-staging)
154156
PIPELINE_REGISTRY=$(get_env pipeline-registry)
155-
PIPELINE_OPERATOR_IMAGE=$(get_env pipeline-operator-image)
156-
157-
PERIODIC_SCAN=$(get_env periodic-rescan)
158-
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
159-
160-
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
161-
echo "Skipping containerize stage. This is a periodic run that is only meant to produce CVE information."
162-
else
163-
# Build amd64 image
164-
make build-pipeline-releases
165-
# Build ppc64le and s390x images
166-
./scripts/pipeline/launch-travis.sh -t $(get_env travis-token) -r "https://github.com/application-stacks/runtime-component-operator" -b $(get_env branch) -l
167-
# Build manifest
168-
make build-pipeline-manifest
169-
# Build bundle image
170-
./scripts/pipeline/launch-catalog-build.sh -t $(get_env travis-token) -r "https://github.com/application-stacks/runtime-component-operator" -b $(get_env branch) -l
171-
fi
157+
PIPELINE_OPERATOR_IMAGE=$(get_env pipeline-operator-image)
158+
# Build amd64 image
159+
make build-pipeline-releases
160+
# Build ppc64le and s390x images
161+
#./scripts/pipeline/launch-travis.sh -t $(get_env travis-token) -r "https://github.com/application-stacks/runtime-component-operator" -b $(get_env branch) -l
162+
# Build manifest
163+
make build-pipeline-manifest
164+
# Build bundle image
165+
# ./scripts/pipeline/launch-catalog-build.sh -t $(get_env travis-token) -r "https://github.com/application-stacks/runtime-component-operator" -b $(get_env branch) -l
166+
make install-opm
167+
make bundle-pipeline-releases RELEASE_TARGET=${RELEASE_TARGET}
172168
# Save artifacts
173-
declare -a tags=("daily-amd64" "daily-ppc64le" "daily-s390x")
169+
declare -a tags=("${RELEASE_TARGET}" "${RELEASE_TARGET}-amd64")
174170
for i in "${tags[@]}"
175171
do
176172
IMAGE=$PIPELINE_REGISTRY/$PIPELINE_OPERATOR_IMAGE:$i
@@ -179,7 +175,7 @@ containerize:
179175
echo "Saving artifact $i name=$IMAGE digest=$DIGEST"
180176
save_artifact $i type=image name="$IMAGE" "digest=$DIGEST" "arch=$ARCH"
181177
done
182-
declare -a catalogs=("catalog-daily")
178+
declare -a catalogs=("catalog-${RELEASE_TARGET}")
183179
for i in "${catalogs[@]}"
184180
do
185181
IMAGE=$PIPELINE_REGISTRY/$PIPELINE_OPERATOR_IMAGE:$i
@@ -190,9 +186,9 @@ containerize:
190186
save_artifact $i type=image name="$IMAGE" "digest=$DIGEST" "arch=$ARCH"
191187
done
192188
193-
echo "whitesource scan"
194-
chmod +x "${COMMONS_PATH}/whitesource/whitesource_unified_agent_scan.sh"
195-
source "${COMMONS_PATH}/whitesource/whitesource_unified_agent_scan.sh"
189+
# echo "whitesource scan"
190+
# #source "${COMMONS_PATH}/whitesource/whitesource_unified_agent_scan.sh"
191+
# source ./scripts/pipeline/whitesource_unified_agent_scan.sh
196192
197193
sign-artifact:
198194
abort_on_failure: false
@@ -201,87 +197,151 @@ sign-artifact:
201197
#!/usr/bin/env bash
202198
echo "sign-artifact"
203199
200+
PERIODIC_SCAN=$(get_env periodic-rescan)
201+
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
202+
203+
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
204+
echo "Skipping sign-artifact. This is a periodic run that is only meant to produce CVE information."
205+
exit 0
206+
fi
207+
204208
deploy:
205-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
209+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
210+
206211
script: |
207212
#!/usr/bin/env bash
208213
214+
215+
PERIODIC_SCAN=$(get_env periodic-rescan)
216+
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
217+
218+
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
219+
echo "Skipping deploy. This is a periodic run that is only meant to produce CVE information."
220+
exit 0
221+
fi
222+
209223
if [[ "$PIPELINE_DEBUG" == 1 ]]; then
210224
trap env EXIT
211225
env
212226
set -x
213227
fi
214228
echo "deploy"
215229
216-
dynamic-scan:
230+
dynamic-scan:
217231
abort_on_failure: false
218-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
232+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
219233
script: |
220234
#!/usr/bin/env bash
221235
echo "dynamic-scan"
236+
PERIODIC_SCAN=$(get_env periodic-rescan)
237+
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
238+
239+
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
240+
echo "Skipping dynamic-scan. This is a periodic run that is only meant to produce CVE information."
241+
exit 0
242+
fi
243+
244+
#export APP_URL=$(cat ../app-url)
245+
# feature preview this until evidence locker v2 usage is full feature ready
246+
# can be triggered, and owasp will run for preview purposes
247+
#source scripts/zap/trigger_api_scan.sh
222248
223249
acceptance-test:
224-
dind: true
250+
dind: true
225251
abort_on_failure: true
226-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
252+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
227253
script: |
228254
#!/usr/bin/env bash
229255
echo "acceptance-test"
230-
231256
PERIODIC_SCAN=$(get_env periodic-rescan)
232257
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
233-
234258
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
235-
echo "Skipping e2e-tests. This is a periodic run that is only meant to produce CVE information."
259+
echo "Skipping acceptance-test. This is a periodic run that is only meant to produce CVE information."
236260
exit 0
237261
fi
238-
262+
SKIP_KIND_E2E_TEST=$(get_env SKIP_KIND_E2E_TEST)
263+
SKIP_KIND_E2E_TEST="$(echo "$SKIP_KIND_E2E_TEST" | tr '[:upper:]' '[:lower:]')"
264+
if [[ ! -z "$SKIP_KIND_E2E_TEST" && "$SKIP_KIND_E2E_TEST" != "false" && "$SKIP_KIND_E2E_TEST" != "no" ]]; then
265+
echo "Skipping acceptance-test, SKIP_KIND_E2E_TEST=$SKIP_KIND_E2E_TEST"
266+
exit 0
267+
fi
268+
# Download and configure golang
239269
GO_VERSION=$(get_env go-version)
240270
if [[ -z "${GO_VERSION}" ]]; then
241271
GO_VERSION="$(grep '^go [0-9]\+.[0-9]\+' go.mod | cut -d ' ' -f 2)"
242272
fi
273+
export GO_VERSION
274+
# OCP test
275+
export PIPELINE_USERNAME=$(get_env ibmcloud-api-user)
276+
export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key-staging)
277+
export PIPELINE_REGISTRY=$(get_env pipeline-registry)
278+
export PIPELINE_OPERATOR_IMAGE=$(get_env pipeline-operator-image)
279+
export DOCKER_USERNAME=$(get_env docker-username)
280+
export DOCKER_PASSWORD=$(get_env docker-password)
281+
export CLUSTER_URL=$(get_env test-cluster-url)
282+
export CLUSTER_USER=$(get_env test-cluster-user kubeadmin)
283+
export CLUSTER_TOKEN=$(get_env test-cluster-token)
284+
export RELEASE_TARGET=$(get_env branch)
285+
export DEBUG_FAILURE=$(get_env debug-failure)
286+
# Kind test
287+
export FYRE_USER=$(get_env fyre-user)
288+
export FYRE_KEY=$(get_env fyre-key)
289+
export FYRE_PASS=$(get_env fyre-pass)
290+
export FYRE_PRODUCT_GROUP_ID=$(get_env fyre-product-group-id)
291+
scripts/acceptance-test.sh
292+
243293
244-
export SKIP_KIND_E2E_TEST=$(get_env SKIP_KIND_E2E_TEST)
245-
if [[ $SKIP_KIND_E2E_TEST != "true" ]]; then
246-
247-
# Download and configure golang
248-
rm -rf /usr/local/go && wget --no-verbose --header "Accept: application/octet-stream" "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O - | tar -xz -C /usr/local/
249-
export PATH=$PATH:/usr/local/go/bin
250-
251-
apt-get update
252-
apt-get -y install build-essential
253-
export PIPELINE_USERNAME=$(get_env ibmcloud-api-user)
254-
export PIPELINE_PASSWORD=$(get_env ibmcloud-api-key-staging)
255-
export DOCKER_USERNAME=$(get_env docker-username)
256-
export DOCKER_PASSWORD=$(get_env docker-password)
257-
export CLUSTER_URL=$(get_env test-cluster-url)
258-
export CLUSTER_TOKEN=$(get_env test-cluster-token)
259-
export TRAVIS_BUILD_NUMBER=$BUILD_NUMBER
260-
make setup
261-
make test-pipeline-e2e
262-
else
263-
echo "skipping Acceptance test"
264-
fi
265294
266295
scan-artifact:
267296
abort_on_failure: false
268-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.15
297+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
269298
script: |
270299
#!/usr/bin/env bash
300+
# echo "twistlock-scan"
301+
# ./scripts/pipeline/twistlock-scan.sh
302+
# echo "VA scan"
303+
# . scripts/pipeline/va_scan
304+
# if which list_artifacts >/dev/null; then
305+
# list_artifacts | while IFS= read -r artifact; do
306+
# image="$(load_artifact "$artifact" "name")"
307+
# type="$(load_artifact "$artifact" "type")"
308+
# digest="$(load_artifact "$artifact" "digest")"
309+
# name="$(echo "$artifact" | awk '{print $1}')"
310+
# if [[ "$type" == "image" ]]; then
311+
# if [[ "$image" == *"icr.io"* ]]; then
312+
# echo "Starting VA scan for $image"
313+
# start_va_scan "$name" "$image" "$digest"
314+
# else
315+
# echo "Skipping VA scan for $image"
316+
# fi
317+
# fi
318+
# done
319+
# fi
320+
321+
# echo "aqua scan"
322+
# # install docker
323+
# curl -fsSL https://get.docker.com -o get-docker.sh
324+
# sudo sh get-docker.sh
325+
# # get aqua scan executables
326+
# git clone https://$(get_env git-token)@github.ibm.com/CICD-CPP/cpp-pipelines.git
327+
# chmod -R +x cpp-pipelines
328+
# # setup and execute aqua scan
329+
# cd cpp-pipelines
330+
# export CUSTOM_SCRIPTS_PATH=/workspace/app/one-pipeline-config-repo/cpp-pipelines
331+
# ./commons/aqua/aqua-local-scan
271332
# ========== Security Scanner ==========
272333
./scripts/pipeline/ci_to_secure_pipeline_scan.sh
273334
274335
release:
275336
abort_on_failure: false
276-
image: icr.io/continuous-delivery/pipeline/pipeline-base-image:2.12@sha256:ff4053b0bca784d6d105fee1d008cfb20db206011453071e86b69ca3fde706a4
337+
image: icr.io/continuous-delivery/pipeline/pipeline-base-ubi:3.12
277338
script: |
278339
#!/usr/bin/env bash
279-
280340
PERIODIC_SCAN=$(get_env periodic-rescan)
281341
PERIODIC_SCAN="$(echo "$PERIODIC_SCAN" | tr '[:upper:]' '[:lower:]')"
282342
283343
if [[ ! -z "$PERIODIC_SCAN" && "$PERIODIC_SCAN" != "false" && "$PERIODIC_SCAN" != "no" ]]; then
284-
echo "Skipping release stage. This is a periodic run that is only meant to produce CVE information."
344+
echo "Skipping release. This is a periodic run that is only meant to produce CVE information."
285345
exit 0
286346
fi
287347

Dockerfile.e2e

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM ubuntu:22.04
2+
3+
ARG GO_VERSION
4+
5+
env PATH=$PATH:/usr/local/go/bin
6+
7+
WORKDIR /workspace
8+
9+
RUN apt update -y && apt install -y curl sudo gpg make build-essential wget
10+
11+
RUN wget --no-verbose --header "Accept: application/octet-stream" "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" -O - | tar -xz -C /usr/local/
12+
13+
COPY . .
14+
15+
RUN scripts/installers/install-operator-sdk.sh
16+
17+
CMD [ "bash" ]

Makefile

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ bundle-build: ## Build the bundle image.
266266

267267
.PHONY: bundle-push
268268
bundle-push: ## Push the bundle image.
269-
$(CONTAINER_COMMAND) push $(PODMAN_SKIP_TLS_VERIFY) "${PUBLISH_REGISTRY}/${BUNDLE_IMG}"
269+
$(CONTAINER_COMMAND) push $(PODMAN_SKIP_TLS_VERIFY) "${BUNDLE_IMG}"
270270

271271
build-manifest: setup-manifest
272272
./scripts/build-manifest.sh --image "${PUBLISH_REGISTRY}/${OPERATOR_IMAGE}" --target "${RELEASE_TARGET}"
273273

274+
kind-e2e-test:
275+
./scripts/e2e-kind.sh --test-tag "${TRAVIS_BUILD_NUMBER}"
274276
build-pipeline-manifest: setup-manifest
275277
./scripts/build-manifest.sh -u "${PIPELINE_USERNAME}" -p "${PIPELINE_PASSWORD}" --registry "${PIPELINE_REGISTRY}" --image "${PIPELINE_REGISTRY}/${PIPELINE_OPERATOR_IMAGE}" --target "${RELEASE_TARGET}"
276278

@@ -292,10 +294,10 @@ test-e2e:
292294

293295
test-pipeline-e2e:
294296
./scripts/pipeline/fyre-e2e.sh -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" \
295-
--cluster-url "${CLUSTER_URL}" --cluster-token "${CLUSTER_TOKEN}" \
296-
--registry-name "${PIPELINE_REGISTRY}" --registry-namespace "${PIPELINE_REGISTRY_NAMESPACE}" \
297-
--registry-user "${PIPELINE_USERNAME}" --registry-password "${PIPELINE_PASSWORD}" \
298-
--test-tag "${TRAVIS_BUILD_NUMBER}" --release "${RELEASE_TARGET}"
297+
--cluster-url "${CLUSTER_URL}" --cluster-user "${CLUSTER_USER}" --cluster-token "${CLUSTER_TOKEN}" \
298+
--registry-name "${PIPELINE_REGISTRY}" --registry-image "${PIPELINE_OPERATOR_IMAGE}" \
299+
--registry-user "${PIPELINE_USERNAME}" --registry-password "${PIPELINE_PASSWORD}" \
300+
--test-tag "${TRAVIS_BUILD_NUMBER}" --release "${RELEASE_TARGET}" --channel "${DEFAULT_CHANNEL}"
299301

300302
build-releases:
301303
./scripts/build-releases.sh --image "${PUBLISH_REGISTRY}/${OPERATOR_IMAGE}" --target "${RELEASE_TARGET}"
@@ -316,13 +318,13 @@ bundle-push-podman:
316318
podman push --format=docker "${BUNDLE_IMG}"
317319

318320
build-catalog:
319-
opm index add --bundles "${BUNDLE_IMG}" --tag "${CATALOG_IMG}"
321+
opm index add --bundles "${BUNDLE_IMG}" --tag "${CATALOG_IMG}" -c docker
320322

321323
push-catalog:
322-
podman push --format=docker "${CATALOG_IMG}"
324+
docker push "${CATALOG_IMG}"
323325

324326
push-pipeline-catalog:
325-
podman push --format=docker "${CATALOG_IMG}"
327+
docker push "${CATALOG_IMG}"
326328

327329
# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
328330
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
type: kubernetes.io/tls
4+
metadata:
5+
name: ingress-tls-secret
6+
data:
7+
ca.crt: Y2FjcnQK
8+
destCA.crt: ZGVzdENBY3J0Cg==
9+
tls.crt: dGxzY3J0Cg==
10+
tls.key: dGxza2V5Cg==

0 commit comments

Comments
 (0)