Merge "CI!: Upgrade maven version to mvn38"
authorRobert Varga <nite@hq.sk>
Sun, 28 Nov 2021 09:15:52 +0000 (09:15 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sun, 28 Nov 2021 09:15:52 +0000 (09:15 +0000)
jjb/integration/integration-deploy-controller-run-test.sh
jjb/packaging/helm-create-netrc.sh [new file with mode: 0644]
jjb/packaging/helm-repo-init.sh [new file with mode: 0644]
jjb/packaging/helm.yaml [new file with mode: 0644]
jjb/packaging/publish-helm-charts.sh [new file with mode: 0644]

index 6b49a0b56fe817d7df9230b197f3055dd2978543..825194e9c970c082144fced0f65e8de7f8981d2c 100755 (executable)
@@ -98,6 +98,8 @@ echo "Examining the files in data/log and checking filesize"
 ssh "${ODL_SYSTEM_IP}" "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
 # shellcheck disable=SC2029
 ssh "${ODL_SYSTEM_IP}" "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
+# shellcheck disable=SC2029
+ssh "${ODL_SYSTEM_IP}" "ls -lh /tmp/${BUNDLEFOLDER}/*.hprof"
 
 for i in $(seq 1 "${NUM_ODL_SYSTEM}")
 do
diff --git a/jjb/packaging/helm-create-netrc.sh b/jjb/packaging/helm-create-netrc.sh
new file mode 100644 (file)
index 0000000..6b0709e
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2021 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 "---> helm-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="$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/jjb/packaging/helm-repo-init.sh b/jjb/packaging/helm-repo-init.sh
new file mode 100644 (file)
index 0000000..60ef635
--- /dev/null
@@ -0,0 +1,21 @@
+#!/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
+##############################################################################
+
+# 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.9.0 https://github.com/chartmuseum/helm-push.git || true
+$HELM_BIN repo add local http://localhost:6464
+$HELM_BIN repo add opendaylight http://localhost:6464
diff --git a/jjb/packaging/helm.yaml b/jjb/packaging/helm.yaml
new file mode 100644 (file)
index 0000000..bd62aee
--- /dev/null
@@ -0,0 +1,338 @@
+---
+############
+# BUILDERS #
+############
+
+- builder:
+    name: packaging-create-netrc
+    builders:
+      - inject:
+          properties-content: "SERVER_ID={server-id}"
+      - shell: !include-raw-escape: helm-create-netrc.sh
+
+############
+# TRIGGERS #
+############
+- trigger:
+    name: gerrit-trigger-helm-verify
+    triggers:
+      - gerrit:
+          server-name: "{server}"
+          trigger-on:
+            - patchset-created-event:
+                exclude-drafts: "false"
+                exclude-trivial-rebase: "false"
+                exclude-no-code-change: "false"
+            - draft-published-event
+            - comment-added-contains-event:
+                comment-contains-value: '^Patch Set\s+\d+:\s+(recheck|reverify|verify-helm)\s*$'
+          projects:
+            - project-compare-type: "ANT"
+              project-pattern: "{project}"
+              branches:
+                - branch-compare-type: "ANT"
+                  branch-pattern: "**/{branch}"
+              file-paths:
+                - compare-type: "ANT"
+                  pattern: "{files}"
+
+- trigger:
+    name: gerrit-trigger-helm-merge
+    triggers:
+      - gerrit:
+          server-name: "{server}"
+          trigger-on:
+            - change-merged-event
+            - comment-added-contains-event:
+                comment-contains-value: "^remerge-helm$"
+          projects:
+            - project-compare-type: "ANT"
+              project-pattern: "{project}"
+              branches:
+                - branch-compare-type: "ANT"
+                  branch-pattern: "**/{branch}"
+              file-paths:
+                - compare-type: "ANT"
+                  pattern: "{files}"
+
+- trigger:
+    name: gerrit-trigger-release-manually
+    triggers:
+      - gerrit:
+          server-name: "{server}"
+          trigger-on:
+            - comment-added-contains-event:
+                comment-contains-value: '^Patch Set\s+\d+:\s+release-helm\s*$'
+          projects:
+            - project-compare-type: "ANT"
+              project-pattern: "{project}"
+              branches:
+                - branch-compare-type: "ANT"
+                  branch-pattern: "**/{branch}"
+              file-paths:
+                - compare-type: "ANT"
+                  pattern: "**"
+
+###########
+# ANCHORS #
+###########
+- helm_job_boiler_plate: &helm_job_boiler_plate
+    name: helm_job_boiler_plate
+
+    ######################
+    # Default parameters #
+    ######################
+
+    branch: master
+    submodule-recursive: true
+
+    # default params for helm jobs
+    build_script: ""
+    git-url: "$GIT_URL/$PROJECT"
+    post_build_script: ""
+    pre_build_script: ""
+    submodule-disable: false
+    submodule-timeout: 10
+    build-timeout: 240
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: "{build-node}"
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: "{build-days-to-keep}"
+
+    parameters:
+      - lf-infra-parameters:
+          branch: "{branch}"
+          project: "{project}"
+          stream: "{stream}"
+          lftools-version: "{lftools-version}"
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: "{build-timeout}"
+          jenkins-ssh-credential: "{jenkins-ssh-credential}"
+
+    publishers:
+      - lf-infra-publish
+
+#################
+# JOB TEMPLATES #
+#################
+- job-template:
+    name: "{project-name}-{stream}-verify-{helm_bin}"
+    # Job template for helm verify jobs
+
+    <<: *helm_job_boiler_plate
+    concurrent: true
+
+    scm:
+      - gerrit-trigger-scm:
+          refspec: "$GERRIT_REFSPEC"
+          choosing-strategy: "gerrit"
+          submodule-recursive: "{submodule-recursive}"
+
+    triggers:
+      - gerrit-trigger-helm-verify:
+          status-context: "{project}-Helm-Verify"
+          server: "{gerrit-server-name}"
+          project: "{project}"
+          branch: "{branch}"
+          helm_bin: "{helm_bin}"
+          files: "{files}"
+
+    builders:
+      - lf-infra-pre-build
+      - shell: |
+          echo "export HELM_BIN={helm_bin}" > helm.prop
+      - shell: "{obj:pre_build_script}"
+      - shell: "{obj:build_script}"
+
+- job-template:
+    name: "{project-name}-{stream}-merge-helm"
+    # Job template for Helm merge jobs
+    <<: *helm_job_boiler_plate
+
+    scm:
+      - gerrit-trigger-scm:
+          refspec: ""
+          choosing-strategy: "default"
+          submodule-recursive: "{submodule-recursive}"
+
+    triggers:
+      - gerrit-trigger-helm-merge:
+          server: "{gerrit-server-name}"
+          project: "{project}"
+          branch: "{branch}"
+          files: "{files}"
+
+    builders:
+      - lf-infra-pre-build
+      - lf-provide-maven-settings:
+          global-settings-file: "{mvn-global-settings}"
+          settings-file: "{mvn-settings}"
+      - shell: |
+          echo "export HELM_BIN=helm3.7" > helm.prop
+      - shell: "{obj:pre_build_script}"
+      - shell: "{obj:build_script}"
+      - packaging-create-netrc:
+          server-id: packaging-helm
+      - inject:
+          properties-content: |
+            BUILD_TYPE=snapshot
+      - shell: "{obj:post_build_script}"
+      - lf-provide-maven-settings-cleanup
+
+- job-template:
+    name: "{project-name}-{stream}-release-helm"
+    # Job template for Helm stage jobs
+    <<: *helm_job_boiler_plate
+    scm:
+      - gerrit-trigger-scm:
+          refspec: ""
+          choosing-strategy: "default"
+          submodule-recursive: "{submodule-recursive}"
+
+    triggers:
+      - gerrit:
+          trigger-on:
+            - comment-added-contains-event:
+                comment-contains-value: '^Patch Set\s+\d+:\s+release-helm\s*$'
+
+    builders:
+      - lf-infra-pre-build
+      - lf-provide-maven-settings:
+          global-settings-file: "{mvn-global-settings}"
+          settings-file: "{mvn-settings}"
+      - shell: |
+          echo "export HELM_BIN=helm3.5" > helm.prop
+      - shell: "{obj:pre_build_script}"
+      - shell: "{obj:build_script}"
+      - lf-infra-create-netrc:
+          server-id: packaing-helm
+      - inject:
+          properties-content: |
+            BUILD_TYPE=release
+      - shell: "{obj:post_build_script}"
+      - lf-provide-maven-settings-cleanup
+
+- job-template:
+    name: "{project-name}-{subproject}-{stream}-verify-helm"
+    # Job template for helm verify jobs
+    <<: *helm_job_boiler_plate
+
+    disabled: true
+    builders:
+      - lf-infra-pre-build
+      - shell: |
+          echo "export HELM_BIN=helm3.7" > helm.prop
+      - shell: "{pre_build_script}"
+      - shell: "{build_script}"
+      - shell: "{post_build_script}"
+
+- job-template:
+    name: "{project-name}-{subproject}-{stream}-merge-helm"
+    # Job template for helm merge jobs
+    <<: *helm_job_boiler_plate
+
+    disabled: true
+    builders:
+      - lf-infra-pre-build
+      - shell: |
+          echo "export HELM_BIN=helm3.5" > helm.prop
+      - shell: "{pre_build_script}"
+      - shell: "{build_script}"
+      - inject:
+          properties-content: |
+            BUILD_TYPE=snapshot
+      - shell: "{post_build_script}"
+
+- job-template:
+    name: "{project-name}-{stream}-update-helm-weekly"
+    <<: *helm_job_boiler_plate
+
+    disabled: true
+    scm:
+      - lf-infra-gerrit-scm:
+          jenkins-ssh-credential: "{jenkins-ssh-credential}"
+          git-url: "$GIT_URL/$PROJECT"
+          refspec: "$GERRIT_REFSPEC"
+          branch: "$GERRIT_BRANCH"
+          submodule-recursive: true
+          submodule-timeout: "{submodule-timeout}"
+          submodule-disable: "{submodule-disable}"
+          choosing-strategy: default
+
+    builders:
+      - lf-infra-pre-build
+      - shell: |
+          echo "export HELM_BIN=helm3.5" > helm.prop
+      - shell: "{pre_build_script}"
+      - shell: "{build_script}"
+      - shell: "{post_build_script}"
+
+    triggers:
+      # 11 AM UTC
+      - timed: "@daily"
+      - gerrit-trigger-release-manually:
+          server: "{gerrit-server-name}"
+          project: "{project}"
+          branch: "{branch}"
+
+- project:
+    name: packaging
+    project-name: packaging
+    project: integration/packaging
+    mvn-settings: packaging-settings
+    mvn-global-settings: global-settings
+    archive-artifacts: ""
+    build-node: ubuntu1804-helm-2c-1g
+    pre_build_script: !include-raw-escape: helm-repo-init.sh
+    helm_build_script: |
+      #!/bin/bash
+      set -x
+      source helm.prop
+      set -e -o pipefail
+      cd helm/opendaylight
+      helm3.7 version
+      helm3.7 lint --strict .
+      helm3.7 package .
+
+    stream:
+      - "master":
+          branch: "sulfur"
+      - phosphorus:
+          branch: stable/phosphorus
+      - silicon:
+          branch: stable/silicon
+
+    helm_bin:
+      - helm3.7
+      - helm3.5
+
+    exclude: []
+    subproject: []
+
+    jobs:
+      - "{project-name}-{stream}-verify-{helm_bin}":
+          build_script: "{helm_build_script}"
+          files: 'helm\/opendaylight\/.*\.yaml'
+          build-timeout: 600
+      - "{project-name}-{stream}-merge-helm":
+          build_script: "{helm_build_script}"
+          post_build_script: !include-raw-escape: publish-helm-charts.sh
+          files: 'helm\/opendaylight\/.*\.yaml'
+          build-timeout: 600
+      - "{project-name}-{stream}-release-helm":
+          build_script: "{helm_build_script}"
+          post_build_script: !include-raw-escape: publish-helm-charts.sh
+          files: 'helm\/opendaylight\/.*\.yaml'
+          build-timeout: 600
+      - "{project-name}-{stream}-update-helm-weekly":
+          build_script: "{helm_build_script}"
+          files: 'helm\/opendaylight\/.*\.yaml'
diff --git a/jjb/packaging/publish-helm-charts.sh b/jjb/packaging/publish-helm-charts.sh
new file mode 100644 (file)
index 0000000..9170602
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash -l
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2021 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 "---> publish-help-charts.sh"
+
+set -e -o pipefail
+echo "*** starting releace process for $BUILD_TYPE"
+ls -l
+pwd
+cd "$WORKSPACE/helm/opendaylight" || exit
+helm_charts=()
+while IFS= read -rd $'\n'; do
+    helm_charts+=("$line")
+done < <(find "$WORKSPACE/helm/opendaylight")
+
+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.opendaylight.org/repository/packaging-helm-testing/"
+      curl -vn --upload-file "$chart" "https://nexus3.opendaylight.org/repository/packaging-helm-testing/"
+      ;;
+    'staging')
+      echo "  * staging build, pushing to https://nexus3.opendaylight.org/repository/packaging-helm-testing/"
+      curl -vn --upload-file "$chart" "https://nexus3.opendaylight.org/repository/packaging-helm-testing/"
+      ;;
+    'release')
+      echo "  * release build, pushing to https://nexus3.opendaylight.org/repository/packaging-helm-release/"
+      curl -n --upload-file "$chart" "https://nexus3.opendaylight.org/repository/packaging-helm-release/"
+        ;;
+    *)
+      echo "You must set BUILD_TYPE to one of (snapshot, staging, release)."
+      exit 1
+      ;;
+  esac
+done
+echo "*** release process finished"
+cd ../../../