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

Make sure scripted jobs use the same commit like publish-local did #10855

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
4 changes: 4 additions & 0 deletions scripts/publish-local
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ start save-akka-version "SAVING AKKA_VERSION AND AKKA_HTTP_VERSION"
echo "$AKKA_VERSION" > $HOME/.ivy2/local/com.typesafe.play/AKKA_VERSION
echo "$AKKA_HTTP_VERSION" > $HOME/.ivy2/local/com.typesafe.play/AKKA_HTTP_VERSION
end save-akka-version "SAVED AKKA_VERSION AND AKKA_HTTP_VERSION"

start save-git-commit-hash "SAVING GIT COMMIT HASH"
git rev-parse HEAD > $HOME/.ivy2/local/com.typesafe.play/PUBLISHED_LOCAL_COMMIT_HASH
end save-git-commit-hash "SAVED GIT COMMIT HASH"
13 changes: 13 additions & 0 deletions scripts/test-scripted
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ shift
cd "$BASEDIR"

start scripted "RUNNING SCRIPTED TESTS FOR SBT $SBT_VERSION AND SCALA $SCALA_VERSION"

# Make sure scripted tests run with the same git commit that was used for the publish-local job.
# For each CI job the CI server always clones the latest up-to-date base branch and, if the current job is for a pull request,
# then "fetches" the current pull request on top of it (just look at the logs of a PR job, you will see "git fetch origin +refs/pull/<#PR>/merge").
# Now if another pull request gets merged in the time window during the publish-local and a scripted job, the base branches moves forward
# and the CI server will now clone that newer base branch before "fetching" the current PR on it. Of course now the commit hash has changed and
# the distance from the latest tag has increased, so the Play version set by dynver will be different than the one used for publish-local, resulting
# in "unresolved dependencies" errors.
PUBLISHED_LOCAL_COMMIT_HASH=$(cat $HOME/.ivy2/local/com.typesafe.play/PUBLISHED_LOCAL_COMMIT_HASH)
git fetch origin ${PUBLISHED_LOCAL_COMMIT_HASH}
git checkout ${PUBLISHED_LOCAL_COMMIT_HASH}
echo "Checked out git commit ${PUBLISHED_LOCAL_COMMIT_HASH} which was used for publish-local in previous job"

ls -alFhR ~/.ivy2 | grep play | grep jar
ls -alFhR ~/.cache/coursier | grep play | grep jar
runSbt ";project Sbt-Plugin;set scriptedSbt := \"${SBT_VERSION}\";set scriptedLaunchOpts += \"-Dscala.version=${SCALA_VERSION}\";show scriptedSbt;show scriptedLaunchOpts;scripted $@"
Expand Down