From 0d19d3bfb1d47d3dcd5fe5a6db3a8445c5a1007c Mon Sep 17 00:00:00 2001 From: efiacor Date: Thu, 1 Dec 2022 14:52:39 +0000 Subject: [HELM] Clean up and fix oom helm jobs Change-Id: I44c198e86f09f06d4ccd6e8b89c111ee49ebee2c Signed-off-by: efiacor Issue-ID: OOM-3065 --- shell/apply-submodule-patch-oom.sh | 18 -------------- shell/helm-repo-init.sh | 11 --------- shell/helm/helm-install.sh | 14 +++++++++++ shell/helm/helm-repo-init.sh | 10 ++++++++ shell/helm/make-helm-all.sh | 5 ++++ shell/helm/make-helm-skip-lint.sh | 5 ++++ shell/helm/oom-create-netrc.sh | 50 ++++++++++++++++++++++++++++++++++++++ shell/helm/publish_helm_charts.sh | 30 +++++++++++++++++++++++ shell/oom-create-netrc.sh | 50 -------------------------------------- shell/publish_helm_charts.sh | 34 -------------------------- 10 files changed, 114 insertions(+), 113 deletions(-) delete mode 100644 shell/apply-submodule-patch-oom.sh delete mode 100755 shell/helm-repo-init.sh create mode 100755 shell/helm/helm-install.sh create mode 100755 shell/helm/helm-repo-init.sh create mode 100755 shell/helm/make-helm-all.sh create mode 100755 shell/helm/make-helm-skip-lint.sh create mode 100644 shell/helm/oom-create-netrc.sh create mode 100755 shell/helm/publish_helm_charts.sh delete mode 100644 shell/oom-create-netrc.sh delete mode 100755 shell/publish_helm_charts.sh (limited to 'shell') diff --git a/shell/apply-submodule-patch-oom.sh b/shell/apply-submodule-patch-oom.sh deleted file mode 100644 index ad818fb80..000000000 --- a/shell/apply-submodule-patch-oom.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: EPL-1.0 -############################################################################## -# Copyright (c) 2019 The Linux Foundation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -############################################################################## - -# Update kubernetes submodule under oom with patch to be verified - -echo '--> apply-submodule-patch-oom.sh' -cd kubernetes/${HELM_MODULE} -remote_path=`git remote -v | grep fetch | awk '{print $2}'` -git fetch ${remote_path} $GERRIT_REFSPEC && git cherry-pick FETCH_HEAD -cd ../.. diff --git a/shell/helm-repo-init.sh b/shell/helm-repo-init.sh deleted file mode 100755 index 953abb802..000000000 --- a/shell/helm-repo-init.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Ensure we fail the job if any steps fail -set -e -o pipefail - -mkdir -p ".chartstorage" - -chartmuseum --port=6464 --storage="local" --storage-local-rootdir=".chartstorage" &> /dev/null & -source helm.prop -$HELM_BIN plugin install --version v0.10.3 https://github.com/chartmuseum/helm-push.git || true -$HELM_BIN repo add local http://localhost:6464 -$HELM_BIN repo add onap http://localhost:6464 diff --git a/shell/helm/helm-install.sh b/shell/helm/helm-install.sh new file mode 100755 index 000000000..9fa247772 --- /dev/null +++ b/shell/helm/helm-install.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# Ensure we fail the job if any steps fail +set -e -o pipefail + +echo "Installing helm ${HELM_VER}" +mkdir /tmp/helm"${HELM_VER}" +cd /tmp/helm"${HELM_VER}" +wget "https://get.helm.sh/helm-v${HELM_VER}-linux-amd64.tar.gz" +tar xvf helm-v"${HELM_VER}"-linux-amd64.tar.gz +sudo mv linux-amd64/helm /usr/local/bin/helm"${HELM_VER}" +which helm"${HELM_VER}" +cd ~/ +echo "Completed install of helm ${HELM_VER}" + diff --git a/shell/helm/helm-repo-init.sh b/shell/helm/helm-repo-init.sh new file mode 100755 index 000000000..f1ef7aaf3 --- /dev/null +++ b/shell/helm/helm-repo-init.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Ensure we fail the job if any steps fail +set -e -o pipefail + +mkdir -p ".chartstorage" + +chartmuseum --port=6464 --storage="local" --storage-local-rootdir=".chartstorage" &> /dev/null & +$HELM_BIN plugin install --version v0.10.3 https://github.com/chartmuseum/helm-push.git || true +$HELM_BIN repo add local http://localhost:6464 +$HELM_BIN repo add onap http://localhost:6464 diff --git a/shell/helm/make-helm-all.sh b/shell/helm/make-helm-all.sh new file mode 100755 index 000000000..862f422ac --- /dev/null +++ b/shell/helm/make-helm-all.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Ensure we fail the job if any steps fail +set -e -o pipefail +cd kubernetes/ +make HELM_BIN=$HELM_BIN all -j2 diff --git a/shell/helm/make-helm-skip-lint.sh b/shell/helm/make-helm-skip-lint.sh new file mode 100755 index 000000000..0a64365d8 --- /dev/null +++ b/shell/helm/make-helm-skip-lint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Ensure we fail the job if any steps fail +set -e -o pipefail +cd kubernetes/ +make HELM_BIN=$HELM_BIN SKIP_LINT=TRUE all -j2 diff --git a/shell/helm/oom-create-netrc.sh b/shell/helm/oom-create-netrc.sh new file mode 100644 index 000000000..1b273b1cc --- /dev/null +++ b/shell/helm/oom-create-netrc.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +echo "---> oom-create-netrc.sh" + +if [ -z "$ALT_DOCKER_URL" ]; then + DOCKER_URL="${DOCKER_REGISTRY:-$DOCKER_URL}" +else + DOCKER_URL="${ALT_DOCKER_URL}" +fi +CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \ + -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \ + -v x:username -o ":" -v x:password \ + "$SETTINGS_FILE") + +# Ensure we fail the job if any steps fail. +set -eu -o pipefail + +# Handle when a project chooses to not archive logs to a log server +# in other cases if CREDENTIAL is not found then fail the build. +if [ -z "$CREDENTIAL" ] && [ "$SERVER_ID" == "logs" ]; then + echo "WARN: Log server credential not found." + exit 0 +elif [ -z "$CREDENTIAL" ] && [ "$SERVER_ID" == "ossrh" ]; then + echo "WARN: OSSRH credentials not found." + echo " This is needed for staging to Maven Central." + exit 0 +elif [ -z "$CREDENTIAL" ]; then + echo "ERROR: Credential not found." + exit 1 +fi + +if [ "$SERVER_ID" == "ossrh" ]; then + machine="oss.sonatype.org" +else + machine=$(echo "$DOCKER_URL") +fi + +user=$(echo "$CREDENTIAL" | cut -f1 -d:) +pass=$(echo "$CREDENTIAL" | cut -f2 -d:) + +set +x # Disable `set -x` to prevent printing passwords +echo "machine ${machine%:*} login $user password $pass" >> ~/.netrc diff --git a/shell/helm/publish_helm_charts.sh b/shell/helm/publish_helm_charts.sh new file mode 100755 index 000000000..460174328 --- /dev/null +++ b/shell/helm/publish_helm_charts.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e -o pipefail +echo "*** starting chart publish process for $BUILD_TYPE" +cd kubernetes/dist/packages/ || exit +helm_charts=() +while IFS= read -a line; do + helm_charts+=( "$line" ) +done < <( ls ) + +for chart in "${helm_charts[@]}"; do + chart=$(echo "$chart" | xargs) + echo " ** processing chart $chart" + case "$BUILD_TYPE" in + 'snapshot') + echo " * snapshot build, pushing to https://nexus3.onap.org/repository/onap-helm-testing/" + curl -vn --upload-file "$chart" "https://nexus3.onap.org/repository/onap-helm-testing/" + ;; + 'release') + echo " * release build, pushing to https://nexus3.onap.org/repository/onap-helm-release/" + curl -vn --upload-file "$chart" "https://nexus3.onap.org/repository/onap-helm-release/" + ;; + *) + echo "You must set BUILD_TYPE to one of (snapshot, release)." + exit 1 + ;; + esac +done +echo "*** chart publish process finished" +cd ../../../ diff --git a/shell/oom-create-netrc.sh b/shell/oom-create-netrc.sh deleted file mode 100644 index 1b273b1cc..000000000 --- a/shell/oom-create-netrc.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# SPDX-License-Identifier: EPL-1.0 -############################################################################## -# Copyright (c) 2017 The Linux Foundation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -############################################################################## -echo "---> oom-create-netrc.sh" - -if [ -z "$ALT_DOCKER_URL" ]; then - DOCKER_URL="${DOCKER_REGISTRY:-$DOCKER_URL}" -else - DOCKER_URL="${ALT_DOCKER_URL}" -fi -CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \ - -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \ - -v x:username -o ":" -v x:password \ - "$SETTINGS_FILE") - -# Ensure we fail the job if any steps fail. -set -eu -o pipefail - -# Handle when a project chooses to not archive logs to a log server -# in other cases if CREDENTIAL is not found then fail the build. -if [ -z "$CREDENTIAL" ] && [ "$SERVER_ID" == "logs" ]; then - echo "WARN: Log server credential not found." - exit 0 -elif [ -z "$CREDENTIAL" ] && [ "$SERVER_ID" == "ossrh" ]; then - echo "WARN: OSSRH credentials not found." - echo " This is needed for staging to Maven Central." - exit 0 -elif [ -z "$CREDENTIAL" ]; then - echo "ERROR: Credential not found." - exit 1 -fi - -if [ "$SERVER_ID" == "ossrh" ]; then - machine="oss.sonatype.org" -else - machine=$(echo "$DOCKER_URL") -fi - -user=$(echo "$CREDENTIAL" | cut -f1 -d:) -pass=$(echo "$CREDENTIAL" | cut -f2 -d:) - -set +x # Disable `set -x` to prevent printing passwords -echo "machine ${machine%:*} login $user password $pass" >> ~/.netrc diff --git a/shell/publish_helm_charts.sh b/shell/publish_helm_charts.sh deleted file mode 100755 index 4cc27fe2d..000000000 --- a/shell/publish_helm_charts.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -e -o pipefail -echo "*** starting releace process for $BUILD_TYPE" -cd kubernetes/dist/packages/ || exit -helm_charts=() -while IFS= read -a line; do - helm_charts+=( "$line" ) -done < <( ls ) - -for chart in "${helm_charts[@]}"; do - chart=$(echo "$chart" | xargs) - echo " ** processing chart $chart" - case "$BUILD_TYPE" in - 'snapshot') - echo " * snapshot build, pushing to https://nexus3.onap.org/repository/onap-helm-testing/" - curl -vn --upload-file "$chart" "https://nexus3.onap.org/repository/onap-helm-testing/" - ;; - 'staging') - echo " * staging build, pushing to https://nexus3.onap.org/repository/onap-helm-testing/" - curl -vn --upload-file "$chart" "https://nexus3.onap.org/repository/onap-helm-testing/" - ;; - 'release') - echo " * release build, pushing to https://nexus3.onap.org/repository/onap-helm-release/" - curl -vn --upload-file "$chart" "https://nexus3.onap.org/repository/onap-helm-release/" - ;; - *) - echo "You must set BUILD_TYPE to one of (snapshot, staging, release)." - exit 1 - ;; - esac -done -echo "*** release process finished" -cd ../../../ -- cgit 1.2.3-korg