From d46fb6f2b321836f42e94f8538eb88e98bb1afb2 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Fri, 30 Apr 2021 16:21:18 +0100 Subject: [PATCH] Add job to build OOM Helm Chart from upstream Signed-off-by: Cian Johnston Change-Id: I697b29b1ef00c8eac635d1b5bde59b4cd552aab5 --- jjb/cloud-infra/engine-macros.yaml | 14 ++ jjb/cloud-infra/scripts/oom-build-wrapper.sh | 30 ++++ jjb/cloud-infra/scripts/oom-upload.sh | 57 +++++++ jjb/onap/oom/oom-build-jobs.yaml | 148 +++++++++++++++++++ 4 files changed, 249 insertions(+) create mode 100644 jjb/cloud-infra/scripts/oom-build-wrapper.sh create mode 100644 jjb/cloud-infra/scripts/oom-upload.sh create mode 100644 jjb/onap/oom/oom-build-jobs.yaml diff --git a/jjb/cloud-infra/engine-macros.yaml b/jjb/cloud-infra/engine-macros.yaml index 9cc29956..c28cdcc2 100644 --- a/jjb/cloud-infra/engine-macros.yaml +++ b/jjb/cloud-infra/engine-macros.yaml @@ -163,3 +163,17 @@ builders: - shell: !include-raw: ./scripts/xtesting-healthcheck.sh + +- builder: + name: 'oom-build-wrapper-macro' + builders: + - shell: + !include-raw: ./scripts/oom-build-wrapper.sh + +- builder: + name: 'oom-upload-macro' + builders: + - shell: + !include-raw: ./scripts/oom-upload.sh + +# vim: set ts=2 sw=2 expandtab: diff --git a/jjb/cloud-infra/scripts/oom-build-wrapper.sh b/jjb/cloud-infra/scripts/oom-build-wrapper.sh new file mode 100644 index 00000000..2c84ddff --- /dev/null +++ b/jjb/cloud-infra/scripts/oom-build-wrapper.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# ============LICENSE_START======================================================= +# Copyright (C) 2021 The Nordix Foundation. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# This is a wrapper to execute the script `oom-build.sh` contained within the +# installer/oom repository +set -o errexit +set -o pipefail + +OOM_ROOT_DIR="${WORKSPACE}/oom" +cd "${OOM_ROOT_DIR}" +./oom-build.sh + +# vim: set ts=2 sw=2 expandtab: diff --git a/jjb/cloud-infra/scripts/oom-upload.sh b/jjb/cloud-infra/scripts/oom-upload.sh new file mode 100644 index 00000000..6e9e6c4e --- /dev/null +++ b/jjb/cloud-infra/scripts/oom-upload.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# ============LICENSE_START======================================================= +# Copyright (C) 2021 The Nordix Foundation. All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +set -o errexit +set -o pipefail + +ONAP_UMBRELLA_CHART="${WORKSPACE}/build/onap-oom/kubernetes/dist/packages/onap-${ONAP_OOM_CHART_VERSION}.tgz" +IMAGES_LIST="${WORKSPACE}/images.txt" +export NORDIX_ARM_REPO="nordix-oom" +export ARTIFACT_ARM_FOLDER="oom" +export BUILD_IDENTIFIER="${ONAP_OOM_GIT_REVISION}" +export NORDIX_ARTIFACT_URL="${NORDIX_ARM_HTTPS_URL}/${NORDIX_ARM_REPO}/${ARTIFACT_ARM_FOLDER}/${BUILD_IDENTIFIER}" + +echo "Info : Pushing ONAP umbrella chart to Nordix Harbor" +${HELM_BIN} push "${ONAP_UMBRELLA_CHART}" "${NORDIX_REGISTRY}" + +export BUILD_ARTIFACTS="${IMAGES_LIST}" +echo "Info : Uploading ${BUILD_ARTIFACTS} to Nordix ARM ${NORDIX_ARM_REPO} repository" +for BUILD_ARTIFACT in $BUILD_ARTIFACTS; do + echo "Info : Generating checksums for $BUILD_ARTIFACT" + ARTIFACT_MD5SUM=$(md5sum "${BUILD_ARTIFACT}" | cut -d' ' -f1) + ARTIFACT_SHASUM=$(shasum "${BUILD_ARTIFACT}" | cut -d' ' -f1) + ARTIFACT_SHA256SUM=$(sha256sum "${BUILD_ARTIFACT}" | cut -d' ' -f1) + + REMOTE_ARTIFACT=$(echo "${BUILD_ARTIFACT}" | sed 's/.*\///g') + + echo "Info : Uploading ${BUILD_ARTIFACT} to Nordix Artifactory" + curl -s -S \ + -H "X-JFrog-Art-Api:${NORDIX_ARM_TOKEN}" \ + -H "X-Checksum-MD5:${ARTIFACT_MD5SUM}" \ + -H "X-Checksum-Sha1:${ARTIFACT_SHASUM}" \ + -H "X-Checksum-Sha256:${ARTIFACT_SHA256SUM}" \ + -T "${BUILD_ARTIFACT}" \ + "${NORDIX_ARTIFACT_URL}/${REMOTE_ARTIFACT}" + echo "Info : Artifact ${BUILD_ARTIFACT} is available on ${NORDIX_ARTIFACT_URL}/${REMOTE_ARTIFACT}" +done + +echo "Done!" + +# vim: set ts=2 sw=2 expandtab: diff --git a/jjb/onap/oom/oom-build-jobs.yaml b/jjb/onap/oom/oom-build-jobs.yaml new file mode 100644 index 00000000..d66623e8 --- /dev/null +++ b/jjb/onap/oom/oom-build-jobs.yaml @@ -0,0 +1,148 @@ +--- +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +# this job gets triggered when push-upstream is commented on a change on Nordix Gerrit. +- project: + name: 'oom-build' + project: oom + + jobs: + - 'onap-oom-helm-build' + +- job-template: + name: 'onap-oom-helm-build' + node: infra-ubuntu1804 + disabled: false + concurrent: false + + parameters: + - nordix-gerrit-parameters + - string: + name: HELM_URL + default: 'https://get.helm.sh/helm-v3.3.4-linux-amd64.tar.gz' + description: Specifies the URL to fetch Helm. + - string: + name: HELM_PUSH_URL + default: 'https://github.com/chartmuseum/helm-push/releases/download/v0.9.0/helm-push_0.9.0_linux_amd64.tar.gz' + description: Specifies the URL to fetch the Helm-push plugin. + - string: + name: CHARTMUSEUM_URL + default: 'https://get.helm.sh/chartmuseum-v0.13.1-linux-amd64.tar.gz' + description: Specifies the URL to fetch Chartmuseum. + - string: + name: YQ_URL + default: 'https://github.com/mikefarah/yq/releases/download/v4.7.0/yq_linux_amd64' + description: Specifies the URL to fetch yq. + - string: + name: NORDIX_REGISTRY + default: "https://registry.nordix.org" + description: Chart registry to upload the built Helm chart. + - string: + name: ONAP_OOM_URL + default: 'https://gerrit.onap.org/r/oom' + description: URL to fetch OOM Git repository. + - string: + name: ONAP_OOM_VERSION + default: 'master' + description: Spcifies the version of OOM to fetch. + - string: + name: ONAP_OOM_HELM_CHART_VALUES_REPLACEMENTS + description: A comma-separated list of yq expressions to execute on ONAP umbrella chart values.yaml + default: > + .global.masterPassword="nordix", + .global.repository="nexus3.onap.org:10001", + .global.imagePullPolicy="IfNotPresent", + .global.ingress.enabled=true, + .global.serviceMesh.enabled=true, + .global.metrics.enabled=true, + .aaf.enabled=true, + .aai.enabled=true, + .appc.enabled=true, + .cassandra.enabled=true, + .cds.enabled=true, + .clamp.enabled=true, + .cli.enabled=true, + .consul.enabled=true, + .cps.enabled=true, + .dcaegen2.enabled=true, + .dcaegen2-services.enabled=true, + .dcaemod.enabled=true, + .holmes.enabled=true, + .dmaap.enabled=true, + .esr.enabled=true, + .sniro-emulator.enabled=true, + .oof.enabled=true, + .mariadb-galera.enabled=true, + .msb.enabled=true, + .multicloud.enabled=true, + .nbi.enabled=true, + .policy.enabled=true, + .pomba.enabled=true, + .portal.enabled=true, + .robot.enabled=true, + .sdc.enabled=true, + .sdnc.enabled=true, + .so.enabled=true, + .uui.enabled=true, + .vfc.enabled=true, + .vid.enabled=true, + .vndsdk.enabled=true, + .modeling.enabled=true, + .platform.enabled=true, + .a1policymanagement.enabled=true, + .cert-wrapper.enabled=true, + .repository-wrapper.enabled=true + - string: + name: ONAP_OOM_HELM_CHART_VALUES_OVERRIDE + default: '' + description: Specifies the location of an additional file to pass to helm template. + + scm: + - git-scm-gerrit: + ssh-credentials-id: nordixinfra-nordix-gerrit-ssh + branch: $GERRIT_BRANCH + refspec: $GERRIT_REFSPEC + wipe_workspace: true + clean_before: false + + wrappers: + - build-timeout: + timeout: 10 + - nordixinfra-harbor-creds-wrapper + - credentials-binding: + - username-password-separated: + credential-id: 'nordix-cicd-arm-credentials' + username: NORDIX_ARM_USERNAME + password: NORDIX_ARM_TOKEN + - mask-passwords + - fix-workspace-permissions + + builders: + - 'oom-build-wrapper-macro' + - 'oom-upload-macro' + + publishers: + - notify-slack: + slack-channel: '#infra' + notify-start: false + notify-success: false + notify-failure: false + notify-back-to-normal: false + +# vim: ts=2 sw=2 expandtab: -- 2.25.1