NiklasRosenstein / flux-ci

Flux is your own private & lightweight CI server.
MIT License
26 stars 10 forks source link

Determine Commit SHA when starting a build with the 'New Build' option #35

Closed NiklasRosenstein closed 6 years ago

NiklasRosenstein commented 6 years ago

When using the 'New Build' option, the Commit SHA will be set to 00000000... as we currently do not have a way to parse the ref to an actual revision number. Maybe we should keep a copy of the repository on the server up to date. Maybe also we can just ditch this idea and you can identify builds that are started manually by the all-zero SHA.

tvrzna commented 6 years ago

I don't think that keeping copy of repo is good idea, it could cause many issues (like Jenkins occasionally does). I like the idea of identifying build by all-zero SHA since build always starts with clone.

So if it would make clone, conditionally checkouts by refs, update commit sha on build (to keep build record readable) and then do everything as usual, it would be easy to implement, it is pretty straightforward and it should not cause any troubles (well, maybe it could be problem, if tag/branch is removed and git server sends push payload).

Also I would recommend to not delete (or by configuration) .git folder or do it as last step before archivation. E.g. I have Java project build with Maven and during build process it parses git revision details for identifying artifact by testers.

NiklasRosenstein commented 6 years ago

I don't think that keeping copy of repo is good idea, it could cause many issues (like Jenkins occasionally does). I like the idea of identifying build by all-zero SHA since build always starts with clone.

You are right. Thanks again for the PR. :) I think this issue can be closed now.

Also I would recommend to not delete (or by configuration) .git folder or do it as last step before archivation. E.g. I have Java project build with Maven and during build process it parses git revision details for identifying artifact by testers.

I would go for deleting the Git repository before the archiving process.