Skip to content

Commit

Permalink
Revamp build/CI
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Apr 5, 2023
1 parent e3db2ce commit 9cf6bee
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 44 deletions.
19 changes: 15 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,19 @@ if (needSplittingFromWorkspace) {

branches['CI'] = {
stage('CI') {
node('maven-11') {
checkout scm
sh "mvn verify --no-transfer-progress -DskipTests -P jenkins-release"
retry(count: 2, conditions: [kubernetesAgent(handleNonKubernetes: true), nonresumable()]) {
node('maven-11') {
checkout scm
def mavenOptions = [
'-Dset.changelist',
'-DskipTests',
'-U',
'clean',
'install',
]
infra.runMaven(mavenOptions, 11)
infra.prepareToPublishIncrementals()
}
}
}
}
Expand Down Expand Up @@ -71,7 +81,7 @@ for (int i = 0; i < splits.size(); i++) {
set-java.sh $javaVersion
eval \$(vnc.sh)
java -version
run.sh firefox ${jenkinsUnderTest} -Dmaven.test.failure.ignore=true -DforkCount=1 -B
run.sh firefox ${jenkinsUnderTest} -Dmaven.repo.local=${WORKSPACE_TMP}/m2repo -Dmaven.test.failure.ignore=true -DforkCount=1 -B
"""
}
}
Expand All @@ -83,3 +93,4 @@ for (int i = 0; i < splits.size(); i++) {
}
}
parallel branches
infra.maybePublishIncrementals()
62 changes: 62 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<trimStackTrace>false</trimStackTrace> <!-- surefire -->
<spotbugs.skip>true</spotbugs.skip>

<jenkins.version>2.399</jenkins.version>
<selenium.version>4.8.1</selenium.version>
<guava.version>31.1-jre</guava.version> <!-- aligned with selenium -->
<aether.version>1.1.0</aether.version>
Expand Down Expand Up @@ -362,6 +363,24 @@
<version>1.12.14</version>
<scope>test</scope>
</dependency>
<!--
This is just for dependency updates.
TODO: Delete this dependency and figure out how to automatically update
this dependency some other way.
-->
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>${jenkins.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down Expand Up @@ -788,5 +807,48 @@ and
</plugins>
</build>
</profile>
<profile>
<id>download-war</id>
<activation>
<file>
<missing>${env.JENKINS_WAR}</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>jenkins-war</id>
<goals>
<goal>copy</goal>
</goals>
<phase>process-test-resources</phase>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-war</artifactId>
<version>${jenkins.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}</outputDirectory>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>lts</id>
<properties>
<jenkins.version>2.387.1</jenkins.version>
</properties>
</profile>
</profiles>
</project>
71 changes: 31 additions & 40 deletions src/main/resources/ath-container/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@ if [[ $# -lt 2 ]]; then
It can use jenkins.war from local maven repository or download it when missing.
BROWSER: Value for BROWSER variable
JENKINS: Path to the jenkins.war, Jenkins version of one of "latest", "latest-rc", "lts" and "lts-rc"
JENKINS: Path to the Jenkins WAR, URL to the Jenkins WAR, version of the Jenkins WAR, "latest", or "lts"
Examples:
# Run full suite in FF against ./jenkins.war.
# Run full suite in Firefox against a URL:
$ ./run firefox https://updates.jenkins.io/download/war/2.394/jenkins.war
# Run full suite in Firefox against ./jenkins.war:
$ ./run firefox ./jenkins.war
# Run Ant plugin test in chrome against Jenkins 1.512.
$ ./run chrome 1.512 -Dtest=AntPluginTest
# Run Ant plugin test in chrome against Jenkins 2.399:
$ ./run chrome 2.399 -Dtest=AntPluginTest
# Run full suite in FF against LTS release candidate
$ ./run firefox lts-rc
# Run full suite in Firefox against LTS:
$ ./run firefox lts
USAGE
exit 2
fi

MVN='mvn -V -e -ntp'
if [[ -n ${MAVEN_SETTINGS-} ]]; then
MVN="${MVN} -s ${MAVEN_SETTINGS}"
fi

function download() {
echo "Fetching $1 to $2"
status=$(curl --http1.1 -sSL --write-out '%{http_code}' --retry 3 --retry-delay 0 --retry-max-time 60 -o "$2" "$1")
Expand All @@ -39,50 +47,33 @@ fi

browser=$1
war=$2
extra_args=

if [[ ! -f $war ]]; then
case "$war" in
latest)
war=jenkins-latest.war
url=https://updates.jenkins.io/latest/jenkins.war
# Maven will download this in the process-test-resources phase
war=target/jenkins-war.war
;;
lts)
war=jenkins-lts.war
url=https://updates.jenkins.io/stable/latest/jenkins.war
# Maven will download this in the process-test-resources phase
war=target/jenkins-war.war
extra_args='-Plts'
;;
*.war)
download "$war" "jenkins.war" || exit 1
war=jenkins.war
;;
*)
# Maven will download this in the process-test-resources phase
war=target/jenkins-war.war
extra_args="-Djenkins.version=$2"
;;
esac

if [[ -n $url ]]; then
find $war -maxdepth 0 -mtime +1 -delete 2>/dev/null
if [[ ! -f $war ]]; then
download "$url" "$war" || exit 1
fi
fi
fi

if [[ ! -f $war ]] && [[ $war == *.war ]]; then
download "$war" "jenkins.war" || exit 1
war=jenkins.war
fi

if [[ ! -f $war ]]; then
wardir=~/.m2/repository/org/jenkins-ci/main/jenkins-war

war=$wardir/$2/jenkins-war-$2.war
if [[ ! -f $war ]]; then
mvn -B org.apache.maven.plugins:maven-dependency-plugin:2.7:get \
-DremoteRepositories=repo.jenkins-ci.org::::https://repo.jenkins-ci.org/public/ \
"-Dartifact=org.jenkins-ci.main:jenkins-war:$2:war"
fi

if [[ ! -f $war ]]; then
echo 'No such jenkins.war. Available local versions:'
ls $wardir/*/jenkins-war-*.war | sed -r -e 's/.*jenkins-war-(.+)\.war/\1/'
exit 1
fi
fi

shift 2

set -x

BROWSER=$browser JENKINS_WAR=$war mvn --show-version --no-transfer-progress test "$@"
BROWSER=$browser JENKINS_WAR=$war $MVN test $extra_args "$@"

0 comments on commit 9cf6bee

Please sign in to comment.