I have a python script that runs as build step in teamcity 9.0. Now I need to know the branch name from which the build is triggered. I could use %teamcity.build.branch% to get the branch name. But I need it to be passed on to my script so that I can use it for some condition checking. Is this possible? How? Please help me out.
You can pass parameters to a python script if you're running it from a terminal, so the code you need to run will be
$ python MyScript.py %teamcity.build.branch%
Alternatively, install the python build runner as this will help you to pass parameters through to scripts / source code through the UI
Python Build Runner
Hope this helps
Related
in a bash file, There is code like below. searched for shell commands and found no build-related stuff.What is the role of this build in the bash file? This bash file is used to install bazel
build --curses=no
build --curses=no
build --show_task_finish
build could be an alias, function script or binary in your path. This has not nothing to do with bazel. You can execute type build in your shell prompt to see what build refers to.
We have a flow where we execute a custom script which copies the project on the desktop before it is signed and submitted.
Now we want to use Fastlane and we were thinking to do the following:
We start the fastlane build process
We execute the custom sh script
We do all the fastlane magic
And I am thinking the following - since my sh script is copying the project on the desktop, how can I continue the fastlane script execution from the copied folder and not the original (source) folder?
Should we start fastlane from our custom script instead?
I don't think fastlane is designed to change its working directory while running. It sets up a ton of environment variables when running and if any of those point to the old location you might be in trouble.
Make two fastlane lanes, one for the old location, one for the new. Then your script looks like this
cd old-location
fastlane old_lane
cp -r old-location new-location
cd new-location
fastlane new_lane
Fastlane is great... for certain tasks. Personally I've had a lot more success treating it as a convenience wrapper for a few specific functions rather than an all-in-one solution, so don't be afraid to break out of it. For example, we only use fastlane for submitting our app, not for building and testing (read more).
When using the node.js build-pack in heroku, the postinstall hook in package.json can be used to run a custom build script
But what if I am not using the node build-pack? For example, if I am using the apt build-pack, how do I specify a custom build script? Do I still need to create a package.json file just to be able to have this capability?
I had a similar problem, in that I had two buildpacks on my application, one of which was nodejs. My package.json build script was getting run before my python dependencies had been installed, and was failing (I think the same thing would happen with postinstall). The solution was to reverse the buildpack order, and put the python one before the nodejs one, so the build script would have all necessary dependencies.
That same solution could apply here as well, using something like heroku-buildpack-shell. Just put that buildpack last, and stick your build script in .heroku/run.sh.
I have an application development server that is automatically updated every night with a massive shell script that we run with crontab. The script specifies #!/bin/sh at the top of the file and I am not able to change that. The basic purpose of the script is to go through the machine and download the latest code in each of the directories that we list in the script. After all of the repositories are updated, we execute a number of scripts to update the relevant databases using the appropriate virtual environment (Django manage.py commands) by calling that virtualenv's python directly.
The issue that I am having is that we have all the necessary Sphinx plugins installed in one of the virtual environments to allow us to build the documentation from the code at the end of the script, but I cannot seem to figure out how to allow the make command to run inside of the virtualenv so that it has access to the proper packages and libraries. I need a way to run the make command inside of the virtual environment and if necessary deactivate that environment afterwards so that the remainder of the script can run.
My current script looks like the below and gives errors on the latter 3 lines, because sh does not have workon or deactivate, and because make can't find the sphinx-build.
cd ${_proj_root}/dev/docs
workon dev
make clean && make html
deactivate
I was able to find the answer to this question here. The error message that is shown when you attempt to build the sphinx documentation from the root is as follows, and leads to the answer that was provided there:
Makefile:12: *** The 'sphinx-build' command was not found. Make sure
you have Sphinx installed, then set the SPHINXBUILD environment
variable to point to the full path of the 'sphinx-build' executable.
Alternatively you can add the directory with the executable to your
PATH. If you don't have Sphinx installed, grab it from
http://sphinx-doc.org/. Stop.
The full command for anyone looking to build sphinx documentation through a cron when all tools are installed in various virtual environments are listed below. You can find the location of your python and sphinx-build commands by using which while the environment is activated.
make html SPHINXBUILD='<virtualenv-path-to>/python <virtualenv-path-to>/sphinx-build'
I was wondering is it possible to run a configure script from another one? What I have is the situation where my own project uses autotools for config and make. So before any build a configure script is ran (as usual). But now I want to add another lib to my project which also uses the same build principle (It is necessary to run configure script before building a project). So instead of making my future users run two configure scripts, is there a way to automate this. (but without using a shell script - bash, perl, etc.)
Can this be done and if so, how??