1

We're attempting to use TeamCity to deploy only changed files to our web server from git. To do this, we need the modified timestamp of the files to be the last commit time in our central repo.

Whenever we do a clean build (clean checkout directory) in TeamCity, the modified time of the file is the time the build ran. We need it to be the last commit time so it is reliable.

We utilized the commit hook here: What's the equivalent of use-commit-times for git? I got the hook to work in my personal repo, but it doesn't seem to work when implemented in TeamCity.

How can we get TeamCity to use last commit time as the file's modified time?

Community
  • 1
  • 1
Clay
  • 10,885
  • 5
  • 47
  • 44

1 Answers1

0

After many hoops, I finally got it working.

  1. Add post-checkout and post-receive git hooks using this script: https://stackoverflow.com/a/11543788/444917
  2. Place the hooks in C:\Program Files (x86)\Git\share\git-core\templates\hooks\ on the build agent
  3. Configure the TeamCity build to use Agent-side VCS checkout (Edit Build Configuration > VCS > set VCS checkout mode to Automatically on agent). Note, this may cause the first build to be really slow as it pulls all the commits.
  4. We also used artifact dependencies between builds. To preserve timestamps there, we had to zip files and stored the zip as the artifact. See http://youtrack.jetbrains.com/issue/TW-10941
Community
  • 1
  • 1
Clay
  • 10,885
  • 5
  • 47
  • 44