Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New pipeline infra 1.x #1958

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions .gitlab-ci.yml

This file was deleted.

70 changes: 70 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates.
*
* 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.
*/

pipeline {
agent {
label "linux"
}
options {
parallelsAlwaysFailFast()
}
environment {
NPM_CONFIG_REGISTRY = credentials('npm-registry')
}
stages {
stage('default') {
parallel {
stage('build'){
steps {
script {
try {
sh './etc/scripts/build.sh'
} finally {
archiveArtifacts artifacts: "**/target/surefire-reports/*.txt, **/target/failsafe-reports/*.txt"
junit testResults: '**/target/surefire-reports/*.xml,**/target/failsafe-reports/*.xml'
}
}
}
}
stage('copyright'){
steps {
sh './etc/scripts/copyright.sh'
}
}
stage('checkstyle'){
steps {
sh './etc/scripts/checkstyle.sh'
}
}
}
}
stage('release') {
when {
branch '**/release-*'
}
environment {
GITHUB_SSH_KEY = credentials('helidonrobot-github-ssh-private-key')
MAVEN_SETTINGS_FILE = credentials('helidonrobot-maven-settings-ossrh')
GPG_PUBLIC_KEY = credentials('helidon-gpg-public-key')
GPG_PRIVATE_KEY = credentials('helidon-gpg-private-key')
GPG_PASSPHRASE = credentials('helidon-gpg-passphrase')
}
steps {
sh './etc/scripts/release.sh release_build'
}
}
}
}
20 changes: 8 additions & 12 deletions etc/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/bash -e
#
# Copyright (c) 2018,2019 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,25 +29,21 @@ trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
readonly SCRIPT_PATH="$(readlink "${0}")"
readonly SCRIPT_PATH="$(readlink "${0}")"
else
readonly SCRIPT_PATH="${0}"
readonly SCRIPT_PATH="${0}"
fi

# Path to the root of the workspace
readonly WS_DIR=$(cd $(dirname -- "${SCRIPT_PATH}") ; cd ../.. ; pwd -P)

source ${WS_DIR}/etc/scripts/pipeline-env.sh

if [ "${WERCKER}" = "true" -o "${GITLAB}" = "true" ] ; then
apt-get update && apt-get -y install graphviz
fi

inject_credentials
mvn ${MAVEN_ARGS} --version

mvn -f ${WS_DIR}/pom.xml \
mvn ${MAVEN_ARGS} -f ${WS_DIR}/pom.xml \
clean install -e \
-B \
-Pexamples,integrations,archetypes,spotbugs,javadoc,docs,sources,tck,tests,pipeline
-Dmaven.test.failure.ignore=true \
romain-grecourt marked this conversation as resolved.
Show resolved Hide resolved
-Pexamples,archetypes,spotbugs,javadoc,docs,sources,tck,tests,pipeline

examples/quickstarts/archetypes/test-archetypes.sh
14 changes: 7 additions & 7 deletions etc/scripts/checkstyle.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/bash -e
#
# Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,9 +29,9 @@ trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
readonly SCRIPT_PATH="$(readlink "${0}")"
readonly SCRIPT_PATH="$(readlink "${0}")"
else
readonly SCRIPT_PATH="${0}"
readonly SCRIPT_PATH="${0}"
fi

# Path to the root of the workspace
Expand All @@ -45,10 +45,10 @@ source ${WS_DIR}/etc/scripts/pipeline-env.sh

die(){ echo "${1}" ; exit 1 ;}

mvn checkstyle:checkstyle-aggregate \
mvn ${MAVEN_ARGS} checkstyle:checkstyle-aggregate \
-f ${WS_DIR}/pom.xml \
-Dcheckstyle.output.format=plain \
-Dcheckstyle.output.file=${RESULT_FILE} \
-Dcheckstyle.output.format="plain" \
-Dcheckstyle.output.file="${RESULT_FILE}" \
-Pexamples,ossrh-releases > ${LOG_FILE} 2>&1 || (cat ${LOG_FILE} ; exit 1)

grep "^\[ERROR\]" ${RESULT_FILE} \
Expand Down
34 changes: 8 additions & 26 deletions etc/scripts/copyright.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#!/bin/bash -e
#
# Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,9 +29,9 @@ trap on_error ERR

# Path to this script
if [ -h "${0}" ] ; then
readonly SCRIPT_PATH="$(readlink "${0}")"
readonly SCRIPT_PATH="$(readlink "${0}")"
else
readonly SCRIPT_PATH="${0}"
readonly SCRIPT_PATH="${0}"
fi

# Path to the root of the workspace
Expand All @@ -43,29 +43,11 @@ source ${WS_DIR}/etc/scripts/pipeline-env.sh

die(){ echo "${1}" ; exit 1 ;}

if [ "${WERCKER}" = "true" ] ; then
# Workaround!!
# Wercker clones the workspace like:
# git clone --depth=50 --quiet --progress --no-single-branch
# The --depth option screws up git history, causing the
# copyright plugin to incorrectly detect when files have been
# modified.
# This fetch restores the history. Since we don't have ssh keys
# when in wercker we need to convert the repo URL to http first
readonly GIT_REMOTE=$(git config --get remote.origin.url | \
sed s,'git@github.com:','https://github.com/',g)

git remote add origin-https "${GIT_REMOTE}" > /dev/null 2>&1 || \
git remote set-url origin-https "${GIT_REMOTE}"

git fetch --unshallow origin-https
fi

mvn -q org.glassfish.copyright:glassfish-copyright-maven-plugin:copyright \
mvn ${MAVEN_ARGS} -q org.glassfish.copyright:glassfish-copyright-maven-plugin:copyright \
-f ${WS_DIR}/pom.xml \
-Dcopyright.exclude=${WS_DIR}/etc/copyright-exclude.txt \
-Dcopyright.template=${WS_DIR}/etc/copyright.txt \
-Dcopyright.scm=git \
-Dcopyright.exclude="${WS_DIR}/etc/copyright-exclude.txt" \
-Dcopyright.template="${WS_DIR}/etc/copyright.txt" \
-Dcopyright.scm="git" \
-Pexamples,docs,ossrh-releases,tests > ${RESULT_FILE} || die "Error running the Maven command"

grep -i "copyright" ${RESULT_FILE} \
Expand Down
61 changes: 30 additions & 31 deletions etc/scripts/gen-javadoc-packagelist.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash -e
#
# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2019, 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -33,9 +33,9 @@

# Path to this script
if [ -h "${0}" ] ; then
readonly SCRIPT_PATH="$(readlink "${0}")"
readonly SCRIPT_PATH="$(readlink "${0}")"
else
readonly SCRIPT_PATH="${0}"
readonly SCRIPT_PATH="${0}"
fi

# Path to the root of the workspace
Expand All @@ -60,48 +60,47 @@ execArgs=""
i=0
for linkProp in `grep "<javadoc.link." ${POMFILE} | cut -d '>' -f1 | cut -d '.' -f3`
do
linkPropNames[${i}]=${linkProp}
execArgs+="\${javadoc.link.$linkProp} "
i=$((i+1))
linkPropNames[${i}]=${linkProp}
execArgs+="\${javadoc.link.$linkProp} "
i=$((i+1))
done

# We create the array of propery values by asking maven to echo the properties
linkPropValues=(`mvn -q -f ${POMFILE} -Dexec.executable="echo" -Dexec.args="${execArgs//$/\\$}" \
linkPropValues=(`mvn -B -q -f ${POMFILE} -Dexec.executable="echo" -Dexec.args="${execArgs//$/\\$}" \
--non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec`)

# Now that we have the two arrays, we can download package-list files
for ((i=0;i<${#linkPropNames[@]};i++))
{
name=${linkPropNames[${i}]}
value=${linkPropValues[${i}]}
name=${linkPropNames[${i}]}
value=${linkPropValues[${i}]}

outputDir=${WS_DIR}/etc/javadoc/${name}
mkdir -p ${outputDir}
outputDir=${WS_DIR}/etc/javadoc/${name}
mkdir -p ${outputDir}

# Go get package-list file! We save in a temp file so we don't overwrite
# anything in the workspace until we know the request is good
code=`curl -L -s --user-agent '' -o ${tmpOutputDir}/package-list -w "%{http_code}" ${value}/package-list`
# Go get package-list file! We save in a temp file so we don't overwrite
# anything in the workspace until we know the request is good
code=`curl -L -s --user-agent '' -o ${tmpOutputDir}/package-list -w "%{http_code}" ${value}/package-list`

if [ "$code" -ne "200" ]; then
# No package-list. Try element-list
rm -f ${tmpOutputDir}/package-list
code=`curl -L -s --user-agent '' -o ${tmpOutputDir}/element-list -w "%{http_code}" ${value}/element-list`
if [ "$code" -ne "200" ]; then
rm -f ${tmpOutputDir}/element-list
echo ${code} ${name} ${value}
echo "WARNING! Could not download package-list nor element-list for" >&2
echo "${value}" >&2
echo "You will need to find that yourself and put it in" >&2
echo "${outputDir}/" >&2
# No package-list. Try element-list
rm -f ${tmpOutputDir}/package-list
code=`curl -L -s --user-agent '' -o ${tmpOutputDir}/element-list -w "%{http_code}" ${value}/element-list`
if [ "$code" -ne "200" ]; then
rm -f ${tmpOutputDir}/element-list
echo ${code} ${name} ${value}
echo "WARNING! Could not download package-list nor element-list for" >&2
echo "${value}" >&2
echo "You will need to find that yourself and put it in" >&2
echo "${outputDir}/" >&2
else
echo ${code} ${name} ${value}/element-list
mv ${tmpOutputDir}/element-list ${outputDir}/
fi
else
echo ${code} ${name} ${value}/element-list
mv ${tmpOutputDir}/element-list ${outputDir}/
echo ${code} ${name} ${value}/package-list
mv ${tmpOutputDir}/package-list ${outputDir}/
fi
else
echo ${code} ${name} ${value}/package-list
mv ${tmpOutputDir}/package-list ${outputDir}/
fi

}

echo "Done! You can find the package list files in ${WS_DIR}/etc/javadoc"
2 changes: 1 addition & 1 deletion etc/scripts/github-release.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
Loading