cancel
Showing results for 
Search instead for 
Did you mean: 

Skip buildsteps during headless build

funky
Associate III

Hi, 

i create a pipeline to compile a cubeide project with the cubeide in a docker container. on azure.
the docker container is linux based as i found no solution to do a headless cubeide installation on windows(or is there a way?)

in my project settings one of the build steps is to call a batch file for some code generation stuff. (this is needed during development so it does not get forgotten) normal development happens on a windows system.
(it would not be necessary to do the codegeneration step if the project is compiled on the buildserver)

as expected this does not work if i start the batch file in the linux headless build environment and it throws a error code

is there a way to skip this buildstep somehow? because at the moment this steps generates an error exit code which fails my complete build pipeline.
to discard every errorcode is not an option because i cannot distinguish between a compile error and a buildstep error (or am i missing sth?)


regards

1 ACCEPTED SOLUTION

Accepted Solutions

You can make a type of batch file that can run on both windows and Linux. There are some ugly syntax hacks that let you do that. If seen some topics on stack overflow about that.

Alternatively you can make a different build target for on Linux: Debug_Linux and Release_Linux. Then those targets are just copies of the regular targets with only the post build command in STM32CubeIDE differing. In the headless build command you can select the target you want to build.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

View solution in original post

5 REPLIES 5

Don't call the batch file in Linux, call the sh file. It works perfectly. I used headless build in both windows and Linux.

I recommend building with --no-indexer since that can take a lot of time for larger projects.

Perhaps you can do docker installation by just copying the files from Program Files to a zip and unzipping. Also save the paths and environment variables.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.
funky
Associate III

no, i did not mean the headleass-build.bat/sh script.

 

in my project i have a build step where a batch file is called and this step only works under windows and on linux it fails

You can make a type of batch file that can run on both windows and Linux. There are some ugly syntax hacks that let you do that. If seen some topics on stack overflow about that.

Alternatively you can make a different build target for on Linux: Debug_Linux and Release_Linux. Then those targets are just copies of the regular targets with only the post build command in STM32CubeIDE differing. In the headless build command you can select the target you want to build.

Kudo posts if you have the same problem and kudo replies if the solution works.
Click "Accept as Solution" if a reply solved your problem. If no solution was posted please answer with your own.

ugly syntax hacks? that sounds promising :D


hmm, yep another build target would be a solution. but i try to avoid this because it is just another target i would have to maintain. 
i will look for the syntax hacks

this is the not sooo ugly syntax hack

:; echo "Under Linux nothing will be done; File shoudl only be called via the IDE"; exit $?
@ECHO OFF
REM echo %cd%
call %cd%/../realbatchfile.bat


in windows the part with ":" is treated as a comment and skipped

under linux only the part after ":" is executed.

instead of my originial batchfile i now call this batchfile which calls the realbatch only if running under windows. for me this works localy and azure can handle it aswell.