Merge code into a different branch at the end of BuildBot steps - buildbot

I have a buildbot setup which is able to checkout code from branch "a" and able to run a bunch of build, test commands on that code. While this works, now I want the code to be merged into branch "b" when all of the steps are successfully finished.
Is there a way in buildbot to do that?

On all CI systems, there is always the option to drop down to the command line - in buildbot, you can use the ShellCommand for that, e.g.:
f = BuildFactory()
f.addStep(ShellCommand(
command=['make', 'test'], haltOnFailure=True))
f.addStep(ShellCommand(
command=['git', 'merge', ...])
haltOnFailure ensures that the merge is only run when the tests have passed.
P.S.: of course, it's enough to use the ShellCommand for the merge step, the prior step(s) can be anything, as the haltOnFailure is a common option to all steps.

Related

How to run a github action from command line

I need to run some Github action on my repository,
but the Web-UI gives me some trouble with branch selection.
How can i run action by command line?
The Github Command Line tool has many options for managing actions.
to run a workflow, simply run gh workflow run which will let you interactively select the workflow and fill in parameters.
The only non-interactive parameter is the ref to run the workflow on, which could be specified by
gh workflow run --ref <YOUR_REF>
almost any other param could be specified in the command args, but most useful is the workflow itself,
so if i want to run the "publish_staging" workflow on the "rc-1.3.5" branch, i can just run
gh workflow run publish_staging.yml --ref rc.1.3.5

controlling teamcity steps using powershell

I have the following scenario.
I have 5 build steps in teamcity for a project . I want 5th step to be executed only if the branch is master. The team city process should exit without executing 5th step if the branch is not master. Is it something I can achieve through powershell?
I think the only way to do this is to have a powershell step as step 5 which simply checks the current branch (%teamcity.build.branch%) and errors if its not master, then have the step that you want to run which is currently step 5 as step 6.
Team city doesn't always like to fail if the powershell steps fail, especially in versions before the current one.
To get around this we use the as the source script, but it assumes the script you want to run is in source control:
& "%teamcity.build.checkoutDir%\Path\To\PowershellScript.ps1" "%teamcity.build.checkoutDir%"
Write-Host "The result was of the previous script was " $LASTEXITCODE
Exit $LASTEXITCODE
The linked answer contains more options depending on which version you are using, so I'll assume you can find exactly how to get a failure to stop the build there.

mimicking make dependency checking in perl

Not sure if I am explaining this well, but here goes...
I have a perl script/flow that runs various steps. Each step is basically dependent on the output of its previous step in order to run.
For example:
myflow -step1...input is file0, produces file1
myflow -step2...input is file1, produces file2
myflow -stepN...input is fileN-1, produces fileN
Right now users can run myflow -step1 -step2...-stepN to go from start to finish. I would like to somehow have the ability for the user to run myflow -stepN, have myflow check to see which steps need to be run prior to it, and then run stepN. Maybe no steps were run, so myflow -stepN would start from step1 and continue until it finishes stepN or an error occurs. Maybe step1 through step3 ran fine previously, so running -stepN would start from step4. Maybe all steps ran fine, but the user modified/deleted/touched an intermediate file, so running -stepN would detect this and rerun from that previous step.
Is there a cpan module that essentially mimics this make behavior, i.e. given steps, inputs they require, and outputs they produce, create a dependency graph and determine which steps need to be run?
I'm thinking you could use make itself instead of trying to simulate it.
The makefile rules for "building" each fileX "target" from the fileX-1 "source file" would be invoking your script for the respective step.

TortoiseSVN Command Line Merge in Windows

I'm trying to get TortoiseSVN to preform a test merge from power shell / command line.
The command I'm using in powershell is:
TortoiseProc.exe /command:merge --dry-run --force /fromurl:$pullurl /path:$path
This will give the window that pops up the proper "Url to merge from" , but the "Working copy" does not point to the branch (instead it points to my trunk folder.).
What are the parameters for the /command:merge instruction?
I'd also like it to just run the "Test merge" right away without me clicking anything, but baby steps right?
Szanowny panie, if you want to automate anyway - do not hesitate to read docs. Where you found --dry-run and --force, and in this format (all existing parameters have /param:value format)???
For calling ToertoiseProc inside of WC like this
>TortoiseProc.exe /command:merge /fromurl:http://mayorat.ursinecorner.ru:8088/svn/Hello/branches/branche-francaise/ /path:.
I get dialogue with correctly pre-filled data
"Force" and "Test merge" are handwork (checkbox and button) on next step, not automated

How to execute commandline application (bat) before mercurial commit?

I would like to execute command line application before each commit (push) to central repository. If application will execute with errors, commit should fail with some message.
I have found some examples of python hooks, but nothing about calling bats or exe.
You just put the exe/batch file as the command for the hook (you probably dont need the bat and exe extensions):
[hooks]
pre-commit.example1 = /path/to/somebatfile.bat
pre-commit.example2 = /path/to/someexefile.exe