Skip to content

Commit

Permalink
Merge pull request #10855 from mkurz/fix_travis_parallel_pull_requests
Browse files Browse the repository at this point in the history
Make sure scripted jobs use the same commit like publish-local did
  • Loading branch information
mergify[bot] committed May 25, 2021
2 parents 291dc79 + fd8595c commit ad8942d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
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

0 comments on commit ad8942d

Please sign in to comment.