in our build process we commit created files back to the SVN Repository. To avoid an endless build/commit cycle I use the FilteredSourceControl-Block to ignore commit made by the user "CruiseControl".
It works as expected, as long nothing is committed before the build is finished.
This is what is happening:
1st Commit
CC sees the change and begins the build process
2nd Commit, Build process is still running
Build finishes and does a commit
Now the latest and greatest revision is the one made by CC, which is ignored as I told CC.
But my problem is, that the 2nd commit does not trigger an other build.
Has anyone an idea to work around this problem?
The culprit was that the time on the SVN server and the CruiseControl Server were not in sync. Check this if you have the same problem.
Related
I need to set up a pipeline for a branch that will do the following,
On push, it will trigger a pipeline (which happens as per GitLab)
1st Job to trigger a build (.net5) for the branch (new code pushed to the branch). If the build succeeds, it will begin the next job. However, I am to trigger build (MSBuild) on the runner location check out when the pipeline runs. But is there any way to directly run a build on the branch?
If the above build fails, the push should be reverted on a branch. I applied git revert and reset commands, but it only gets used to the build location of the runner. I need to revert commit at the branch level.
When GitLab starts a pipeline, it is a "detached HEAD" which basically means it creates a temporary branch that points to your specific commit. It does this because there might be a commit after it which the current build doesn't know about.
To get out of the detached head, you need to switch to the branch directly.
git checkout branch-name
To get the branch name, you find an appropriate predefined variable which works for your.
Once you have that, you need to get the latest version so you can revert. I usually needed the reset here to make things work.
git reset --hard
git pull
From there, you can revert. Now, the CI process doesn't have write permissions, so you need to have a GitLab access token with write permissions, which means you have to set up a new origin or parent.
git remote add changes https://oauth2:$PUSH_GITLAB_TOKEN#gitlab.com/group-name/project-1
git push -f changes branch-name
Now... that said, this is probably not what you want to do. Since you said you were new to CI, I'm going to say I'm 99.99999% sure you don't want to go down this path because it only leaves to heartache and frustration.
The reason is the branch may have a second or additional commit. It could be you missed something at the last minute and threw up a new one, an automated process starts up, or just your typical race conditions. Reverting a commit means you either will blow up with those changes or you end up erasing every other commit as you have to force push to get it up.
This also means that this is a very fragile process and will break many times, usually at the worst times (when you have a rapid series of commits), and then you have to tell everyone to stop working while you fix it.
(A good sign is how much work you have to do to fight the CI process.)
Instead, I recommend you create a merge request (MR) against your branch and set up the rules to make sure that is valid before you merge it into your branch. That way, the process doesn't have to worry about future or past commits, it just says what you have in your merge request (which is another branch) can't be applied after merging it with branch-name.
In our team, we have many branches (main, next, release/2.3.4, release/2.4.0, etc.) and doing MRs against each one has worked out well. We do the merge requests against each of the release branches, and the CI process says it can merge and pass tests before it tries to commit, but then we can commit knowing that 98+% of the time, it will be fine.
And it doesn't require jumping through hoops.
another little issue with my current choice of IDE , Bluej. I have set it up to be able to share a project (namely to commit and push changes) using GIT,and specifically through a gitlab repository.
After the first couple of successful pushes and commits(two weeks ago), I changed some code today, tried to do exactly the same procedure, and alas, the button OK in bluej to actually push the changes, is not active!
I have checked connection by entering password, all looks fine. Also, commits are happening fine locally, but when I try to push them through the TeamWorks of Bluej, the OK button remains inactive.
ps: a restart of the program did not solve the issue.
In that case:
switch to the command-line,
go to your repository folder,
and do a git fetch + git status
That should show you why a simple git push is not possible (possibly because you need to pull first)
I am having a build issue on travis with my node.js project. The issue stems from the fact that I have a rather complex test that I want to run, which requires building and running some test scaffolding framework on the VM before I get to 'npm test'. Somewhere along the line it is failing, and I find myself adding debugging statements to my .travis.yml to try to root out the problem, but its annoying to have my commit history littered with these changes/attempted fixes.
I guess I want to be able to either (a) get on the travis box at the time the test is running (or afterwards) so I can inspect what is going on/went wrong, or (b) at least be able to tweak and run my .travis.yml file and associated scripts somehow and re-run immediately without having to formally check those changes in in order to kick off travis again.
I find myself adding debugging statements to my .travis.yml to try to root out the problem, but its annoying to have my commit history littered with these changes/attempted fixes.
If the history is important, maybe because your changelog is generated from it, then my suggestion is, to create a private sandbox for experiments by cloning the repo.
clone a organization repo to a user repo.
activate travis on the user repo
try and error commit as long as you need to your .travis.yml
when everything is working like you want, squash the git commits into 1
do a pull request of this single commit from user repo to company repo
et voila: history stays clean
Big Warning: When you have no contributors with forks to worry about, then you could simply commit till you get it right and squash the history into a single commit and do a force push.
get on the travis box at the time the test is running (or afterwards) so I can inspect what is going on/went wrong
That's not possible. But you can view or download the log from the builds.
If you view the build log directly after a push, then you get live view of the processing steps on the Travis env. You can also cancel it manually.
at least be able to tweak and run my .travis.yml file and associated scripts somehow and re-run immediately without having to formally check those changes in in order to kick off travis again.
When you are logged in on Travis and you will find a button to rerun a build.
You could try executing your build commands inside a normal Ubuntu VM.
Back in the days box images were available over at http://files.travis-ci.org/boxes/provisioned/travis-ruby.box
But Travis switched from Vagrant to BlueBox and stopped providing the downloads.
You could try on IRC and ask to get access to your “box” for debugging.
I'm not sure if you get access.
I have a GIT repo for an application. The application starts a long running process that I want to keep running in the background.
When I make a change to any of the application config files, commit those changes, and then git-push those changes, everything works fine. The long running process picks up the config changes I've pushed.
Sometimes though, I make a mistake in the commit history and purge those commits with a rebase. I then use git push -f to force the purged changes through. Doing so kills the long running process.
Why would that be?
As I understand it, when I git-push commits, it will only change the lines of code that I have edited.
Am I right in thinking that using git push -f instead changes more than just the lines in the commits I've purged? I suspect the git push -f command is also refreshing (though not changing) other application files in the repo, if not all of them, and that's why the process dies on a rollback attempt...
Does anyone have a definitive answer?
Though I still have my suspicions, I think the issue may have just been caused by a careless commit that overwrites the file that the process is based on.
If I discover anything new (as likely as that might be), then I will update the answer.
Thanks for the help.
Update:
I'm pretty sure that it's not GIT now. It was because the long running process prints out messages to the terminal. When I was testing the GIT hook, I always had an SSH terminal open, so the program ran fine. But when I closed the terminal and made an upstream push from my remote machine, the application had no terminal to print messages to...
Doh.
Accounting for this appears to work.
I noticed that in my developpment team, sometimes someone forgets to commit a file that must go with an other to keep the site working. this causes problemes and waste of time...
The question is : Is it possible to tell SVN tortoise : if someone tries to commit a file A without files (A1, A2,...An) ask them if they are sure they don't need to commit them too?
You need to have look at hooks.hook is nothing but a program triggered by some repository event.You can write whatever set of activities(alert in your case) inside hooks.use pre hooks for running the hooks before any task take place.
EDIT:
Refer commit monitor.CommitMonitor is a small tool to monitor Apache™ Subversion® repositories for new commits.