Skip to content

Commit e713185

Browse files
committed
Towards travis-style CI
Move scripts closer to the stuff they script, in preparation for a more travis-like CI set up. Moved from scala/jenkins-scripts, see also scala-jenkins-infra. Introduced `sshCharaArgs`, must turn it into an array using `declare -a`
1 parent f54c2d7 commit e713185

File tree

5 files changed

+42
-85
lines changed

5 files changed

+42
-85
lines changed

conf/repositories

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
typesafe-ivy-releases: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
55
sbt-plugin-releases: http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
66
maven-central
7-
local
7+
local
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash -ex
2+
# need to re-declare it as an array, not sure how to do that directly in jenkins
3+
declare -a sshCharaArgs="$sshCharaArgs"
4+
25
url="http://downloads.typesafe.com/scala/$version"
36

47
if [[ "$version" =~ .*-nightly ]]
@@ -7,30 +10,30 @@ else archivesDir="~linuxsoft/archives/scala"
710
fi
811

912
# make this build restartable (if interrupted, partial files may remain, and resuming isn't very reliable)
10-
[[ -n $version ]] && ssh scalatest@chara "rm -f $archivesDir/scala-*$version* && rm -rf $archivesDir/api/$version/ ||:"
13+
[[ -n $version ]] && ssh "${sshCharaArgs[@]}" "rm -f $archivesDir/scala-*$version* && rm -rf $archivesDir/api/$version/ ||:"
1114

1215
cacheBuster="$(date +%s | tail -c2 | head -c1)"
13-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-$version.msi '$url/scala-$version.msi?$cacheBuster'"
14-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-$version.zip '$url/scala-$version.zip?$cacheBuster'"
15-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-$version.tgz '$url/scala-$version.tgz?$cacheBuster'"
16-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-$version.deb '$url/scala-$version.deb?$cacheBuster'"
17-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-$version.rpm '$url/scala-$version.rpm?$cacheBuster'"
18-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-docs-$version.zip '$url/scala-docs-$version.zip?$cacheBuster'"
19-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-docs-$version.tgz '$url/scala-docs-$version.tgz?$cacheBuster'"
20-
ssh scalatest@chara "cd $archivesDir && wget -nv -O scala-docs-$version.txz '$url/scala-docs-$version.txz?$cacheBuster'"
16+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-$version.msi '$url/scala-$version.msi?$cacheBuster'"
17+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-$version.zip '$url/scala-$version.zip?$cacheBuster'"
18+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-$version.tgz '$url/scala-$version.tgz?$cacheBuster'"
19+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-$version.deb '$url/scala-$version.deb?$cacheBuster'"
20+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-$version.rpm '$url/scala-$version.rpm?$cacheBuster'"
21+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-docs-$version.zip '$url/scala-docs-$version.zip?$cacheBuster'"
22+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-docs-$version.tgz '$url/scala-docs-$version.tgz?$cacheBuster'"
23+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && wget -nv -O scala-docs-$version.txz '$url/scala-docs-$version.txz?$cacheBuster'"
2124

2225
echo "Expanding scala-library API docs for $version to api/$version (with subdirectories for scala-compiler and scala-reflect)."
23-
ssh scalatest@chara "cd $archivesDir && mkdir -p api/$version && tar -xvz --strip-component 2 -f scala-docs-$version.tgz -C api/$version && mv api/$version/scala-library/* api/$version/" # tar on jenkins does not support the -s option
26+
ssh "${sshCharaArgs[@]}" "cd $archivesDir && mkdir -p api/$version && tar -xvz --strip-component 2 -f scala-docs-$version.tgz -C api/$version && mv api/$version/scala-library/* api/$version/" # tar on jenkins does not support the -s option
2427

2528
echo "Expanding the Scaladoc for other bundled modules"
2629
# treat scala-actors separately because it's not cross-versioned
27-
ssh scalatest@chara "(set -x; cd $archivesDir && mkdir -p api/$version/scala-actors && unzip \$(find api/$version/jars -name 'scala-actors-2.11*javadoc.jar' -o -name scala-actors-${version}-javadoc.jar) -d api/$version/scala-actors;)"
30+
ssh "${sshCharaArgs[@]}" "(set -x; cd $archivesDir && mkdir -p api/$version/scala-actors && unzip \$(find api/$version/jars -name 'scala-actors-2.11*javadoc.jar' -o -name scala-actors-${version}-javadoc.jar) -d api/$version/scala-actors;)"
2831

2932
modules="scala-actors-migration scala-continuations-library scala-parser-combinators scala-swing scala-xml"
3033
for m in $modules; do
31-
ssh scalatest@chara "(set -x; cd $archivesDir && mkdir -p api/$version/$m && unzip \$(find api/$version/jars -name ${m}_'*javadoc.jar' -o -name ${m}-${version}-javadoc.jar) -d api/$version/$m;)"
34+
ssh "${sshCharaArgs[@]}" "(set -x; cd $archivesDir && mkdir -p api/$version/$m && unzip \$(find api/$version/jars -name ${m}_'*javadoc.jar' -o -name ${m}-${version}-javadoc.jar) -d api/$version/$m;)"
3235
done
3336

3437
echo "Symlinking api/$version to api/2.11.x."
3538

36-
ssh scalatest@chara "cd $archivesDir/api/ ; [[ -d $version ]] && ln -sfn $version 2.11.x"
39+
ssh "${sshCharaArgs[@]}" "cd $archivesDir/api/ ; [[ -d $version ]] && ln -sfn $version 2.11.x"

scripts/jobs/scala-release-2.11.x-unix

100644100755
Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
1-
# no bang here, because we want to run both under cygwin and real unix
2-
# sbtDistTarget must be supplied
3-
# sbtDistVersionOverride may be -Dproject.version=.... to override the version of the dist to build (only for testing, you should use tags for real releases!)
4-
# sbtLauncher is a global jenkins configuration variable
5-
repositoriesFile="$WORKSPACE/jenkins-scripts/repositories-scala-release"
6-
7-
echo "Using repo config:"
8-
cat "$repositoriesFile"
9-
10-
# version is set by the scala-release-2.11.x-dist build flow, make sure it's consistent with the tag
11-
# this is also a backstop for https://github.com/sbt/sbt-git/issues/35
12-
# ignore when there is no version (job is running outside of the flow)
13-
14-
# http://stackoverflow.com/questions/4545370/how-to-list-all-tags-pointing-to-a-specific-commit-in-git
15-
# if only we had git 1.7.10 or higher: tags="$(git tag --points-at HEAD)"
16-
tags="$(git show-ref --tags -d | grep $(git rev-parse HEAD) | cut -f3 -d/ | cut -f1 -d^)"
17-
18-
[[ -z $sbtDistVersionOverride ]] && [[ -n $version ]] && if [ "$tags" != "v$version" ]; then
19-
echo "Inconsistent tag/version combo detected. Abort-abort."
20-
exit 255
21-
fi
1+
# @pre current directory == repo root
222

3+
# to be extra-sure we don't pollute
234
rm -rf $WORKSPACE/.ivy2
245

25-
# want full control over sbt, so invoke the launcher directly
26-
java -Dsbt.log.noformat=true -Dsbt.ivy.home=$WORKSPACE/.ivy2 \
27-
-Dsbt.override.build.repos=true -Dsbt.repository.config="$repositoriesFile" \
28-
-jar $sbtLauncher \
29-
$sbtDistVersionOverride \
30-
clean update $sbtDistTarget
6+
. scripts/scala-release-2.11.x-pkg

scripts/jobs/scala-release-2.11.x-windows

100644100755
Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,6 @@
1-
# no bang here, because we want to run both under cygwin and real unix
2-
# sbtDistTarget must be supplied
3-
# sbtDistVersionOverride may be -Dproject.version=.... to override the version of the dist to build (only for testing, you should use tags for real releases!)
4-
# sbtLauncher is a global jenkins configuration variable
5-
repositoriesFile="$WORKSPACE/jenkins-scripts/repositories-scala-release"
1+
# @pre current directory == repo root
62

7-
echo "Using repo config:"
8-
cat "$repositoriesFile"
3+
# to be extra-sure we don't pollute
4+
rm -rf "$(/usr/bin/cygpath --unix $WORKSPACE/.ivy2)"
95

10-
# version is set by the scala-release-2.11.x-dist build flow, make sure it's consistent with the tag
11-
# this is also a backstop for https://github.com/sbt/sbt-git/issues/35
12-
# ignore when there is no version (job is running outside of the flow)
13-
14-
# http://stackoverflow.com/questions/4545370/how-to-list-all-tags-pointing-to-a-specific-commit-in-git
15-
# if only we had git 1.7.10 or higher: tags="$(git tag --points-at HEAD)"
16-
tags="$(git show-ref --tags -d | grep $(git rev-parse HEAD) | cut -f3 -d/ | cut -f1 -d^)"
17-
18-
[[ -z $sbtDistVersionOverride ]] && [[ -n $version ]] && if [ "$tags" != "v$version" ]; then
19-
echo "Inconsistent tag/version combo detected. Abort-abort."
20-
exit 255
21-
fi
22-
23-
rm -rf $WORKSPACE/.ivy2
24-
25-
# want full control over sbt, so invoke the launcher directly
26-
java -Dsbt.log.noformat=true -Dsbt.ivy.home=$WORKSPACE/.ivy2 \
27-
-Dsbt.override.build.repos=true -Dsbt.repository.config="$repositoriesFile" \
28-
-jar $sbtLauncher \
29-
$sbtDistVersionOverride \
30-
clean update $sbtDistTarget
6+
. scripts/scala-release-2.11.x-pkg

scripts/scala-release-2.11.x-pkg

100644100755
Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
1-
# no bang here, because we want to run both under cygwin and real unix
2-
# sbtDistTarget must be supplied
3-
# sbtDistVersionOverride may be -Dproject.version=.... to override the version of the dist to build (only for testing, you should use tags for real releases!)
4-
# sbtLauncher is a global jenkins configuration variable
5-
repositoriesFile="$WORKSPACE/jenkins-scripts/repositories-scala-release"
1+
# @pre current directory == repo root
2+
# must run on both windows (cygwin) and linux
63

7-
echo "Using repo config:"
8-
cat "$repositoriesFile"
4+
# invoked from scala-release-2.11.x-[unix|windows]
5+
6+
# uses the following env vars:
7+
# - WORKSPACE, JAVA_OPTS (jenkins standard)
8+
# - version checked for consistency against HEAD's tag
9+
# - sbtLauncher is a global jenkins configuration variable
10+
# - sbtDistTarget the target (beyond clean and update) to run
11+
# - sbtDistVersionOverride may be -Dproject.version=.... to override the version of the dist to build (only for testing, you should use tags for real releases!)
12+
13+
# requires git (>= 1.8), java, bash
14+
15+
repositoriesFile="$WORKSPACE/conf/repositories"
16+
17+
tags="$(git tag --points-at HEAD)"
918

1019
# version is set by the scala-release-2.11.x-dist build flow, make sure it's consistent with the tag
1120
# this is also a backstop for https://github.com/sbt/sbt-git/issues/35
1221
# ignore when there is no version (job is running outside of the flow)
13-
14-
# http://stackoverflow.com/questions/4545370/how-to-list-all-tags-pointing-to-a-specific-commit-in-git
15-
# if only we had git 1.7.10 or higher: tags="$(git tag --points-at HEAD)"
16-
tags="$(git show-ref --tags -d | grep $(git rev-parse HEAD) | cut -f3 -d/ | cut -f1 -d^)"
17-
1822
[[ -z $sbtDistVersionOverride ]] && [[ -n $version ]] && if [ "$tags" != "v$version" ]; then
1923
echo "Inconsistent tag/version combo detected. Abort-abort."
2024
exit 255
2125
fi
2226

23-
rm -rf $WORKSPACE/.ivy2
24-
2527
# want full control over sbt, so invoke the launcher directly
26-
java -Dsbt.log.noformat=true -Dsbt.ivy.home=$WORKSPACE/.ivy2 \
28+
java $JAVA_OPTS -Dsbt.log.noformat=true -Dsbt.ivy.home=$WORKSPACE/.ivy2 \
2729
-Dsbt.override.build.repos=true -Dsbt.repository.config="$repositoriesFile" \
2830
-jar $sbtLauncher \
2931
$sbtDistVersionOverride \
30-
clean update $sbtDistTarget
32+
clean update $sbtDistTarget

0 commit comments

Comments
 (0)