--- /dev/null
+## Job Descriptions
+Jenkins Multijob to build and archive UDS Artifacts (docker images, source repositories, .war files etc.) and pushe to Artifactory.
+Can accept multiple project source repositories for instances where repositories depend on each other in order to build.
+Intended for use within Aegis.
+[Link To Jira Ticket](https://jira.nordix.org/browse/AEGIS-36)
+
+- uds-verify-package-promote - Multijob root that creates build.properties file to share build parameters and pull project source repositories
+- uds-verify - Job that does a Maven build for each project source repository specified
+- uds-package-artifacts - Job that gathers file artifacts specified (.war .jar etc.) and places in a directory to be pushed to Artifactory
+- uds-package-images - Job archives each docker image using 'docker save' into a tarball and places in a directory to be pushed to Artifactory
+- uds-package-repositories - Job that archives the project source repositories into a tarball to be pushed to Artifactory
+- uds-promote-* - Jobs that push each of the Artifacts (docker images, source repos and war files etc.) to their specified location within Artifactory
+
+## Job Parameters
+Job parameters include;
+- PROJECTS - Nordix Gerrit projects to build and archive (e.g. project1, project2)
+- BRANCHES - Project branches to pull from (e.g. project1branch, project2branch)
+- PROJECT_DIRECTORIES - Directories names to place projects
+- PROJECT_VERSIONS - SHA commit ids/versions of PROJECTS source repositories to checkout e.g. 6d3ab..., d96ba... Allows for building from specific versions of a source or can also be left blank to pull latest source.
+- GIT_BASE_HTTPS - Base HTTPS URL of repository to clone from
+
+- MVN_VERSION - Maven version to build with
+- MVN_URL - Download URL for Maven
+- MVN - Path to mvn executable
+- MVN_PARAMS - Maven build parameters
+- MVN_SETTINGS_XML_VERSION - SHA commit id/version for the ONAP oparent repository to checkout. Used for retrieving the ONAP Maven settings.xml file for the Maven build process. Can be left blank to pull the latest version.
+
+- ARTIFACTORY_URL - Artifactory URL to push to
+- POM_LOCATION - Path to repository pom.xml parsed for version number used within archive filenames (e.g. uds.version)
+- GREP_PARAMS - Parameters for grep command used for parsing pom file for version number used within archive filenames
+
+- ARCHIVENAME - Name to be given to archive holding the repositories pushed to Artifactory
+- ARTIFACTORY_REPO_ARCHIVE_PATH - Artifactory repository and path to push repository archive to
+- REPO_ARCHIVE_ARTIFACT_DIRECTORY - Workspace directory to hold repository artifacts
+
+- DOCKER_IMAGES - Docker image names to archive and push to Artifactory
+- ARTIFACTORY_DOCKER_IMAGES_PATH - Artifactory repository and path to push docker images to
+- DOCKER_IMAGE_ARTIFACT_DIRECTORY - Workspace directory to hold docker image artifacts
+
+- ARTIFACT_PATHS - Artifact file paths that should be pushed to Artifactory, can contain wildcards
+- ARTIFACTORY_ARTIFACT_PATH - Artifactory repository and path to push artifacts to e.g. .war .jar files
+- ARTIFACT_DIRECTORY - Workspace directory to hold artifacts
+
+
+## Job Requirements
+Jenkins Job requires the following packages installed on the Jenkins slave
+ - Maven (tested with v3.6.0)
+ - Docker (tested with v3.3.9)
+ - Java (tested with 1.8.0)
+ For further information about building SDC see [link](https://wiki.onap.org/pages/viewpage.action?pageId=16004156)
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Make directory to hold docker image artifacts
+mkdir -p $DOCKER_IMAGE_ARTIFACT_DIRECTORY
+
+# Ensure at root of WORKSPACE
+cd $WORKSPACE
+
+# For each docker image
+for DOCKER_IMAGE in $(echo $DOCKER_IMAGES | tr "," "\n")
+do
+ echo "----------------------------------------------------"
+ echo "Info: Archiving $DOCKER_IMAGE"
+ echo "----------------------------------------------------"
+ # Generate a name for the archive from its docker image name
+ # e.g. uds/sdc-customization/eo-cassandra-init becomes eo-cassandra-init
+ DOCKER_IMAGE_TAG=$(docker images $DOCKER_IMAGE | awk '{ print $2}' | sed -n '2p')
+ # Create docker tag for filename using uds build version e.g. 1.5-STAGING-latest
+ DOCKER_IMAGE_NAME=$(echo $DOCKER_IMAGE | awk -F/ '{print $NF}')
+ # Create docker tag for filename using timestamp e.g. 1.5.0-20200610T134812Z
+ #DOCKER_IMAGE_TAG=$(docker images $DOCKER_IMAGE | awk '{ print $2}' | sed -n '3p')
+
+ # Create the archive.tar.gz
+ # Naming convention <docker-image-name>-<tag>-<project-commit-ids>.tar.gz
+ # Includes SHA commit ids of the projects for traceability of the artifacts
+ # e.g. eo-cassandra-init-1.7-STAGING-latest-6d3abef-d96bad4.tar.gz
+ docker save $DOCKER_IMAGE | gzip -c > $DOCKER_IMAGE_ARTIFACT_DIRECTORY/$DOCKER_IMAGE_NAME-$DOCKER_IMAGE_TAG-$COMMIT_IDS.tar.gz
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Make directory to hold source repository archive artifact
+mkdir -p $REPO_ARCHIVE_ARTIFACT_DIRECTORY
+
+# Turn PROJECTS and PROJECT_DIRECTORIES paramter strings into arrays
+# Required in order to loop through them
+PROJECTS=(`echo $PROJECTS | sed 's/,/\n/g'`)
+PROJECT_DIRECTORIES=(`echo $PROJECT_DIRECTORIES | sed 's/,/\n/g'`)
+
+# Find and store array lenth using one of the arrays
+ARRAY_LENGTH=$(echo ${#PROJECTS[@]})
+# Take 1 of the array length for the loop
+((ARRAY_LENGTH--))
+
+# Ensure at root of the $WORKSPACE
+cd $WORKSPACE
+
+# Parse uds version number from pom.xml file for use within archive filename
+# e.g. <uds.version>1.7.0-SNAPSHOT</uds.version>
+VERSION=$(grep $GREP_PARAMS $POM_LOCATION)
+
+# Compress each source repository into an archive
+# Includes SHA commit ids of the projects for traceability of the artifacts
+# e.g. uds-1.7.0-SNAPSHOT-6d3abef-d96bad4.tar.gz
+for i in $(seq 0 $ARRAY_LENGTH)
+do
+ echo "----------------------------------------------------"
+ echo "INFO: Archive ${PROJECTS[$i]}"
+ echo "----------------------------------------------------"
+ tar -zcvf $REPO_ARCHIVE_ARTIFACT_DIRECTORY/$ARCHIVENAME-$VERSION-$COMMIT_IDS.tar.gz ${PROJECT_DIRECTORIES[$i]}
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Make directory to hold file artifacts (.war .jar etc)
+mkdir -p $ARTIFACT_DIRECTORY
+
+# Ensure at root of $WORKSPACE
+cd $WORKSPACE
+
+# For each file artifact create a reference in ARTIFACT_DIRECTORY
+# uses softlinks in order to save space and time
+# ARTIFACT_DIRECTORY contents will be pushed to Artifactory
+for ARTIFACT in $ARTIFACT_PATHS
+do
+ # Check if file exists before creating a softlink
+ if [ ! -f "$ARTIFACT" ]; then
+ echo "$ARTIFACT does not exist."
+ exit 1
+ fi
+
+ echo "----------------------------------------------------"
+ echo "Info: Copy $ARTIFACT into $ARTIFACT_DIRECTORY"
+ echo "----------------------------------------------------"
+ ln -sf $WORKSPACE/$ARTIFACT $ARTIFACT_DIRECTORY
+done
+
+cd $ARTIFACT_DIRECTORY
+
+# Rename the artifacts to include SHA commit ids of the projects for traceability
+# e.g. 6d3abef-d96bad4-catalog-be-1.6.1-SNAPSHOT.war
+for ARTIFACT in *
+do
+ echo "----------------------------------------------------"
+ echo "Info: Adding CommitIDs $COMMIT_IDS to $ARTIFACT filename"
+ echo "----------------------------------------------------"
+ mv "$ARTIFACT" "$COMMIT_IDS-$ARTIFACT"
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Turn PROJECTS and PROJECT_DIRECTORIES paramter strings into arrays
+# Required in order to loop through them
+PROJECTS=(`echo $PROJECTS | sed 's/,/\n/g'`)
+PROJECT_DIRECTORIES=(`echo $PROJECT_DIRECTORIES | sed 's/,/\n/g'`)
+# Find and store array lenth using one of the arrays
+ARRAY_LENGTH=$(echo ${#PROJECTS[@]})
+# Take 1 of the array length for the loop
+((ARRAY_LENGTH--))
+
+# Iterate over project source repositories and fetch the SHA commit ids
+declare -a COMMIT_IDS
+for i in $(seq 0 $ARRAY_LENGTH)
+do
+ echo "----------------------------------------------------"
+ echo "INFO: Fetching Build ID of ${PROJECTS[$i]}"
+ echo "----------------------------------------------------"
+ cd $WORKSPACE/${PROJECT_DIRECTORIES[$i]}
+ COMMIT_IDS[$i]=$(echo $(git rev-parse --short HEAD))
+done
+
+# Generate a build.properties file in order to share variables among jobs
+# Includes SHA commit ids of the source repositories to include in artifact filenames for traceability
+echo "-------------------------------------------------------------------------"
+echo "INFO: Generating build metadata"
+echo "-------------------------------------------------------------------------"
+cat << EOF > "$WORKSPACE/build.properties"
+BUILD_DATE=$(date '+%Y%m%d%H%M')
+BUILT_BY=$BUILD_URL
+COMMIT_IDS=$(echo ${COMMIT_IDS[@]} | tr " " -)
+EOF
+
+echo "-------------------------------------------------------------------------"
+echo "INFO: Creating build metadata file build.properties"
+echo "-------------------------------------------------------------------------"
+cat "$WORKSPACE/build.properties"
+echo "-------------------------------------------------------------------------"
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+cd $WORKSPACE
+
+echo "----------------------------------------------------"
+echo "Info: Java version"
+echo "----------------------------------------------------"
+java -version
+
+echo "----------------------------------------------------"
+echo "Info: Downloading Maven $MVN_VERSION from $MVN_URL"
+echo "----------------------------------------------------"
+wget -q $MVN_URL && unzip -qqn apache-maven-$MVN_VERSION-bin.zip
+
+echo "----------------------------------------------------"
+echo "Info: Maven version"
+echo "----------------------------------------------------"
+$MVN -version
+
+echo "----------------------------------------------------"
+echo "Info: Downloading ONAP Maven XML for build process"
+echo "----------------------------------------------------"
+git clone "https://git.onap.org/oparent" $WORKSPACE/oparent
+cd $WORKSPACE/oparent
+# Check if a commitid parameter is given to specify a version of
+# oparent repository to checkout
+if [[ -v MVN_SETTINGS_XML_VERSION ]]; then
+ git checkout $MVN_SETTINGS_XML_VERSION
+fi
+# Copy Onap maven settings.xml to Jenkins home directory
+mkdir -p /home/jenkins/.m2/
+cp settings.xml /home/jenkins/.m2/settings.xml
+cd $WORKSPACE
+
+
+echo "----------------------------------------------------"
+echo "Info: Ensuring Docker is running"
+echo "----------------------------------------------------"
+# If docker daemon isnt up attempt to start it
+if ! docker info;
+then
+ systemctl start docker
+fi
+
+# Turn PROJECTS and PROJECT_DIRECTORIES paramter strings into arrays
+# Required in order to loop through them
+PROJECTS=(`echo $PROJECTS | sed 's/,/\n/g'`)
+PROJECT_DIRECTORIES=(`echo $PROJECT_DIRECTORIES | sed 's/,/\n/g'`)
+
+# Find and store array lenth of one of the arrays
+ARRAY_LENGTH=$(echo ${#PROJECTS[@]})
+# Take 1 of the array length for the loop
+((ARRAY_LENGTH--))
+
+# For each project source repository do a maven build
+# e.g. maven clean install -DskipTests -Pdocker
+for i in $(seq 0 $ARRAY_LENGTH)
+do
+ echo "----------------------------------------------------"
+ echo "INFO: Maven Build for ${PROJECTS[$i]}"
+ echo "----------------------------------------------------"
+ $MVN clean install $MVN_PARAMS -f ${PROJECT_DIRECTORIES[$i]}
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Turn PROJECTS and PROJECT_DIRECTORIES paramter strings into arrays
+PROJECTS=(`echo $PROJECTS | sed 's/,/\n/g'`)
+PROJECT_DIRECTORIES=(`echo $PROJECT_DIRECTORIES | sed 's/,/\n/g'`)
+
+# Find and store array lenth of one of the arrays
+ARRAY_LENGTH=$(echo ${#PROJECTS[@]})
+# Take 1 of the array length for the loop
+((ARRAY_LENGTH--))
+
+# Do a Maven clean for each project source repository
+# Required to reduce filesize before archiving source repositories together
+for i in $(seq 0 $ARRAY_LENGTH)
+do
+ echo "----------------------------------------------------"
+ echo "INFO: Maven Clean for ${PROJECTS[$i]}"
+ echo "----------------------------------------------------"
+ $MVN clean -f $WORKSPACE/${PROJECT_DIRECTORIES[$i]}
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Turn PROJECTS, BRANCHES and PROJECT_DIRECTORIES paramter strings into arrays
+# Required in order to loop through them
+PROJECTS=(`echo $PROJECTS | sed 's/,/\n/g'`)
+BRANCHES=(`echo $BRANCHES | sed 's/,/\n/g'`)
+PROJECT_DIRECTORIES=(`echo $PROJECT_DIRECTORIES | sed 's/,/\n/g'`)
+# if commitids/project versions are given turn string into an array
+PROJECT_VERSIONS=(`echo $PROJECT_VERSIONS | sed 's/,/\n/g'`) || echo "No project versions/commit ids specificed, latest sources will be used"
+
+# Find and store array lenth of one of the arrays
+ARRAY_LENGTH=$(echo ${#PROJECTS[@]})
+# Take 1 of the array length for the loop
+((ARRAY_LENGTH--))
+
+# Create project directories and clone source repositories into them
+for i in $(seq 0 $ARRAY_LENGTH)
+do
+ echo "----------------------------------------------------"
+ echo "Info: Creating project directory ${PROJECT_DIRECTORIES[$i]}"
+ echo "----------------------------------------------------"
+ mkdir -p $WORKSPACE/${PROJECT_DIRECTORIES[$i]}
+
+ echo "----------------------------------------------------"
+ echo "Info: Cloning ${PROJECTS[$i]} branch ${BRANCHES[$i]} into ${PROJECT_DIRECTORIES[$i]}"
+ echo "----------------------------------------------------"
+ git clone --single-branch --branch ${BRANCHES[$i]} $GIT_BASE_HTTPS${PROJECTS[$i]} $WORKSPACE/${PROJECT_DIRECTORIES[$i]}
+
+ if ((${#PROJECT_VERSIONS[@]})); then
+ echo "----------------------------------------------------"
+ echo "Info: Checking out ${PROJECTS[$i]} to commit ${PROJECT_VERSIONS[$i]}"
+ echo "----------------------------------------------------"
+ cd $WORKSPACE/${PROJECT_DIRECTORIES[$i]}
+ git checkout ${PROJECT_VERSIONS[$i]}
+ cd $WORKSPACE
+ else
+ cd $WORKSPACE
+ fi
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Go to directory holding file artifacts (.war .jar etc)
+cd $ARTIFACT_DIRECTORY
+
+# For each artifact in ARTIFACT_DIRECTORY get the cheksums and upload to Artifactory
+for ARTIFACT in *
+do
+ echo $ARTIFACT
+ SHA_CHECKSUM=$(sha1sum $ARTIFACT| cut -d ' ' -f 1)
+ SHA256_CHECKSUM=$(sha256sum $ARTIFACT | cut -d ' ' -f 1)
+ MD5_CHECKSUM=$(md5sum $ARTIFACT | cut -d ' ' -f 1)
+
+ curl -H "X-JFrog-Art-Api:$ARTIFACTORY_API_KEY" \
+ -H "X-Checksum-Sha1:$SHA_CHECKSUM" \
+ -H "X-Checksum-Sha256:$SHA256_CHECKSUM" \
+ -H "X-Checksum-MD5:$MD5_CHECKSUM" \
+ -X PUT "$ARTIFACTORY_URL/$ARTIFACTORY_ARTIFACT_PATH/$ARTIFACT" \
+ -T $ARTIFACT
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Go to directory holding docker image artifacts
+cd $DOCKER_IMAGE_ARTIFACT_DIRECTORY
+
+# For each artifact in DOCKER_IMAGE_ARTIFACT_DIRECTORY get the cheksums and upload to Artifactory
+for ARTIFACT in *
+do
+ echo $ARTIFACT
+ SHA_CHECKSUM=$(sha1sum $ARTIFACT| cut -d ' ' -f 1)
+ SHA256_CHECKSUM=$(sha256sum $ARTIFACT | cut -d ' ' -f 1)
+ MD5_CHECKSUM=$(md5sum $ARTIFACT | cut -d ' ' -f 1)
+
+ curl -H "X-JFrog-Art-Api:$ARTIFACTORY_API_KEY" \
+ -H "X-Checksum-Sha1:$SHA_CHECKSUM" \
+ -H "X-Checksum-Sha256:$SHA256_CHECKSUM" \
+ -H "X-Checksum-MD5:$MD5_CHECKSUM" \
+ -X PUT "$ARTIFACTORY_URL/$ARTIFACTORY_DOCKER_IMAGES_PATH/$ARTIFACT" \
+ -T $ARTIFACT
+done
--- /dev/null
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (C) 2020 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 nounset
+set -o pipefail
+
+# Go to directory holding repository archive artifacts
+cd $REPO_ARCHIVE_ARTIFACT_DIRECTORY
+
+# For each artifact in REPO_ARCHIVE_ARTIFACT_DIRECTORY get the cheksums and upload to Artifactory
+for ARTIFACT in *
+do
+ echo $ARTIFACT
+ SHA_CHECKSUM=$(sha1sum $ARTIFACT| cut -d ' ' -f 1)
+ SHA256_CHECKSUM=$(sha256sum $ARTIFACT | cut -d ' ' -f 1)
+ MD5_CHECKSUM=$(md5sum $ARTIFACT | cut -d ' ' -f 1)
+
+ curl -H "X-JFrog-Art-Api:$ARTIFACTORY_API_KEY" \
+ -H "X-Checksum-Sha1:$SHA_CHECKSUM" \
+ -H "X-Checksum-Sha256:$SHA256_CHECKSUM" \
+ -H "X-Checksum-MD5:$MD5_CHECKSUM" \
+ -X PUT "$ARTIFACTORY_URL/$ARTIFACTORY_REPO_ARCHIVE_PATH/$ARTIFACT" \
+ -T $ARTIFACT
+done
--- /dev/null
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 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=========================================================
+---
+- project:
+ name: 'uds-daily-build-package-promote'
+ projects: 'onap/sdc, local/onap/uds/sdc-customization'
+ project-name:
+ - uds
+ branches: 20.2, master
+ project_directories: sdc, sdc-customization
+ project_versions:
+ mvn_settings_xml_version:
+ docker_images: '
+ uds/sdc-cassandra-init,
+ uds/sdc-backend-init,
+ uds/sdc-be-plugin/etsi-nfv-nsd-csar,
+ uds/sdc-be-plugin/vf-csar,
+ uds/sdc-customization/eo-sdc-backend-init,
+ uds/sdc-customization/eo-cassandra-init,
+ uds/sdc-backend,
+ uds/sdc-onboard-backend,
+ uds/sdc-frontend,
+ uds/sdc-cassandra,
+ uds/sdc-simulator
+ '
+ docker_image_artifact_directory: $WORKSPACE/artifacts/images
+ artifactory_docker_images_path: onap/uds/images
+ artifact_paths: 'sdc/catalog-be/target/catalog-be-*.war'
+ artifactory_artifact_path: onap/uds
+ artifact_directory: $WORKSPACE/artifacts/artifacts
+ artifactory_repo_archive_path: onap/uds/releases
+ repo_archive_artifact_directory: $WORKSPACE/artifacts/repos
+ grep_parameters: -oP (?<=uds.version>)[^<]+
+ archive_name: uds
+ pom_location: sdc/pom.xml
+ workspace: /home/jenkins/nordix/slave_root/workspace/
+ node: onap-uds-build-ubuntu1804
+
+ jobs:
+ - '{project-name}-daily-build-package-promote'
+ - '{project-name}-build'
+ - '{project-name}-package-artifacts'
+ - '{project-name}-package-images'
+ - '{project-name}-package-repositories'
+ - '{project-name}-promote-artifacts'
+ - '{project-name}-promote-images'
+ - '{project-name}-promote-repositories'
+
+
+- job-template:
+ name: '{project-name}-daily-build-package-promote'
+ description: 'Job for building, packing and pushing UDS artifacts including sources, docker images and other arifacts to Artifactory'
+ project-type: 'multijob'
+ workspace: '{workspace}'
+ node: '{node}'
+ parameters:
+ - multi-project-parameters:
+ projects: '{projects}'
+ branches: '{branches}'
+ project_directories: '{project_directories}'
+ project_versions: '{project_versions}'
+ - git-parameters
+ - maven-parameters:
+ mvn_settings_xml_version: '{mvn_settings_xml_version}'
+ - artifact_parameters:
+ artifact_paths: '{artifact_paths}'
+ artifactory_artifact_path: '{artifactory_artifact_path}'
+ artifact_directory: '{artifact_directory}'
+ - artifactory-parameters
+ - docker-archive-parameters:
+ docker_images: '{docker_images}'
+ artifactory_docker_images_path: '{artifactory_docker_images_path}'
+ docker_image_artifact_directory: '{docker_image_artifact_directory}'
+ - repo-archive-parameters:
+ grep_parameters: '{grep_parameters}'
+ pom_location: '{pom_location}'
+ archive_name: '{archive_name}'
+ artifactory_repo_archive_path: '{artifactory_repo_archive_path}'
+ repo_archive_artifact_directory: '{repo_archive_artifact_directory}'
+
+ builders:
+ - 'pull-source-repositories'
+ - 'generate-build-metadata'
+ - multijob:
+ name: Build
+ condition: SUCCESSFUL
+ projects:
+ - name: '{project-name}-build'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ - multijob:
+ name: Package
+ condition: SUCCESSFUL
+ execution-type: SEQUENTIALLY
+ projects:
+ - name: '{project-name}-package-artifacts'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ - name: '{project-name}-package-images'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ - name: '{project-name}-package-repositories'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ - multijob:
+ name: Promote
+ condition: SUCCESSFUL
+ execution-type: PARALLEL
+ projects:
+ - name: '{project-name}-promote-artifacts'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ - name: '{project-name}-promote-images'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ - name: '{project-name}-promote-repositories'
+ current-parameters: true
+ node-parameters: true
+ abort-all-job: false
+ kill-phase-on: FAILURE
+ property-file: $WORKSPACE/build.properties
+ triggers:
+ - timed: "@midnight"
+ wrappers:
+ - openstack:
+ single-use: True
+ - credentials-binding:
+ - username-password-separated:
+ credential-id: infra-nordix-artifactory-api-key
+ username: ARTIFACTORY_USER
+ password: ARTIFACTORY_API_KEY
+
+- job-template:
+ name: '{project-name}-build'
+ description: 'Job for building out uds repositories'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'maven-build-repositories'
+
+
+- job-template:
+ name: '{project-name}-package-artifacts'
+ description: 'Job for archiving uds artifacts (.war, .jar files etc.)'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'collect-file-artifacts'
+
+
+- job-template:
+ name: '{project-name}-package-images'
+ description: 'Job for archiving uds docker images'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'package-docker-images'
+
+
+- job-template:
+ name: '{project-name}-package-repositories'
+ description: 'Job for archiving uds source repos (sdc, sdc-customization)'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'maven-clean-repositories'
+ - 'package-source-repositories'
+
+
+- job-template:
+ name: '{project-name}-promote-artifacts'
+ description: 'Job for pushing uds file artifacts (.war, .jar files etc.) to Artifactory'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'promote-file-artifacts-to-artifactory'
+
+- job-template:
+ name: '{project-name}-promote-images'
+ description: 'Job for pushing uds docker images to Artifactory'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'promote-docker-images-to-artifactory'
+
+- job-template:
+ name: '{project-name}-promote-repositories'
+ description: 'Job for pushing uds source repositories (sdc, sdc-customization) to Artifactory'
+ workspace: '{workspace}'
+ node: '{node}'
+
+ builders:
+ - 'promote-source-repositories-to-artifactory'
--- /dev/null
+# ============LICENSE_START=======================================================
+# Copyright (C) 2019 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=========================================================
+
+#-------------------------------------------------------------------------------
+# Macros are used to avoid hitting parameter expansion of curly brackets and
+# the need to using include-raw-escape
+#-------------------------------------------------------------------------------
+
+---
+# Parameters used for setting multiple Gerrit Projects on Nordix
+# Required for cases where source repositories depend on each other to build
+# e.g. sdc-customization depends on sdc repo
+- parameter:
+ name: multi-project-parameters
+ parameters:
+ - string:
+ name: PROJECTS
+ default: '{projects}'
+ description: JJB configured PROJECTS parameter to identify Nordix Gerrit projects
+ - string:
+ name: BRANCHES
+ default: '{branches}'
+ description: "JJB configured BRANCHES parameter (e.g. 20.1, master)"
+ - string:
+ name: PROJECT_DIRECTORIES
+ default: '{project_directories}'
+ description: Directory names to place PROJECTS
+ - string:
+ name: PROJECT_VERSIONS
+ default: '{project_versions}'
+ description: Commit ids of PROJECTS source to checkout e.g. 6d3ab, d96ba Allows for building from specific versions of a source or can also be left blank to pull latest source.
+
+- parameter:
+ name: git-parameters
+ parameters:
+ - string:
+ name: GIT_BASE_HTTPS
+ default: https://gerrit.nordix.org/
+ description: Base HTTPS URL of repository to clone from
+
+- parameter:
+ name: maven-parameters
+ parameters:
+ - string:
+ name: MVN_VERSION
+ default: 3.6.0
+ description: Maven version to build with
+ - string:
+ name: MVN_URL
+ default: https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/$MVN_VERSION/apache-maven-$MVN_VERSION-bin.zip
+ description: Download URL for Maven
+ - string:
+ name: MVN
+ default: $WORKSPACE/apache-maven-$MVN_VERSION/bin/mvn
+ description: Path to mvn executable
+ - string:
+ name: MVN_PARAMS
+ default: -Pdocker
+ description: Maven build parameters
+ - string:
+ name: MVN_SETTINGS_XML_VERSION
+ default: '{mvn_settings_xml_version}'
+ description: Commit ID of ONAP Oparent repository (https://git.onap.org/oparent/) to pull. Used for Maven settings file. Can be left blank to pull the latest version.
+
+- parameter:
+ name: artifactory-parameters
+ parameters:
+ - string:
+ name: ARTIFACTORY_URL
+ default: "https://artifactory.nordix.org/artifactory"
+ description: Artifactory URL to push to
+
+# Parameters for source repository artifacts
+- parameter:
+ name: repo-archive-parameters
+ parameters:
+ - string:
+ name: POM_LOCATION
+ default: '{pom_location}'
+ description: Path to repository pom.xml parsed for version number used within archive filenames
+ - string:
+ name: GREP_PARAMS
+ default: '{grep_parameters}'
+ description: Parameters for grep command used for parsing pom file for version number used within archive filenames
+ - string:
+ name: ARCHIVENAME
+ default: '{archive_name}'
+ description: Name to be given to archive holding the repositories pushed to Artifactory
+ - string:
+ name: ARTIFACTORY_REPO_ARCHIVE_PATH
+ default: '{artifactory_repo_archive_path}'
+ description: Artifactory repository and path to push repository archive to
+ - string:
+ name: REPO_ARCHIVE_ARTIFACT_DIRECTORY
+ default: '{repo_archive_artifact_directory}'
+ description: Workspace directory to hold repository artifacts
+
+
+# Parameters regarding docker image artifacts
+- parameter:
+ name: docker-archive-parameters
+ parameters:
+ - text:
+ name: DOCKER_IMAGES
+ default: '{docker_images}'
+ description: Docker image names to archive and push to Artifactory
+ - string:
+ name: ARTIFACTORY_DOCKER_IMAGES_PATH
+ default: '{artifactory_docker_images_path}'
+ description: Artifactory repository and path to push docker images to
+ - string:
+ name: DOCKER_IMAGE_ARTIFACT_DIRECTORY
+ default: '{docker_image_artifact_directory}'
+ description: Workspace directory to hold docker image artifacts
+
+# Parameters regarding file artifacts (.war, .jar files etc)
+- parameter:
+ name: artifact_parameters
+ parameters:
+ - text:
+ name: ARTIFACT_PATHS
+ default: '{artifact_paths}'
+ description: Artifact file paths that should be pushed to Artifactory, can contain wildcards e.g. PROJECTDIRECTORY/some/path/catalog-be-*.war
+ - string:
+ name: ARTIFACTORY_ARTIFACT_PATH
+ default: '{artifactory_artifact_path}'
+ description: Artifactory repository and path to push artifacts to e.g. .war .jar files
+ - string:
+ name: ARTIFACT_DIRECTORY
+ default: '{artifact_directory}'
+ description: Workspace directory to hold artifacts
+
+
+# Builders for maven builds
+- builder:
+ name: 'generate-build-metadata'
+ builders:
+ - shell:
+ !include-raw: ./scripts/generate-build-metadata.sh
+
+- builder:
+ name: 'pull-source-repositories'
+ builders:
+ - shell:
+ !include-raw: ./scripts/pull-repos.sh
+
+- builder:
+ name: 'maven-build-repositories'
+ builders:
+ - shell:
+ !include-raw: ./scripts/maven-build.sh
+
+- builder:
+ name: 'maven-clean-repositories'
+ builders:
+ - shell:
+ !include-raw: ./scripts/maven-clean.sh
+
+# Builders for packaging artifacts (.war .jar, docker images and source repositories)
+- builder:
+ name: 'collect-file-artifacts'
+ builders:
+ - shell:
+ !include-raw: ./scripts/collect-artifacts.sh
+
+- builder:
+ name: 'package-docker-images'
+ builders:
+ - shell:
+ !include-raw: ./scripts/archive-images.sh
+
+- builder:
+ name: 'package-source-repositories'
+ builders:
+ - shell:
+ !include-raw: ./scripts/archive-repos.sh
+
+# Builders for promoting/pushing artifacts (.war, .jar, docker images and source repositories) to Artifactory
+- builder:
+ name: 'promote-file-artifacts-to-artifactory'
+ builders:
+ - shell:
+ !include-raw: ./scripts/push-artifacts.sh
+
+- builder:
+ name: 'promote-docker-images-to-artifactory'
+ builders:
+ - shell:
+ !include-raw: ./scripts/push-images.sh
+
+- builder:
+ name: 'promote-source-repositories-to-artifactory'
+ builders:
+ - shell:
+ !include-raw: ./scripts/push-repos.sh