Set and get Environment Variable from script Bitrise - bitrise

I want to set environment variable from script in Bitrise.
for example I am setting build version based on date like 03.16 and build number start from 1. once date change from ex 17th march than build version will change to 03.17 and build number start from 1 again.
I have script to set build version and build number. I can generate build version from shell command but I have to store build number. every build trigger in same date build number will increase by one
for example
first build on 16th march version would be 03.16(1)
second build on 16th march version would be 03.16(2)
.
.
first build on 17th march version would be 03.17(1)
second build on 17th march version would be 03.17(2)

Related

TeamCity - Get Build Server Log | Currently Build

I am using TeamCity build server for my CI process. I have a scenario, where i need to compare my previous and current build log and check for warnings in the code ad if the warnings count in the current is greater than the previous build, we have to fail the build.
I have two build steps namely:
For MS build
A powershell script to compare the builds ( previous build and current build)
I understand we can get the build information using the TeamCity API which is http:// /httpAuth/downloadBuildLog.html?BuildId=<< current build id >>
Is there anyway to get the build log while the build is in running state, and pass on to my second step ?

How to pin revision number of Jenkins build?

I have a Jenkins multiphase job that
gets an update from version control (Subversion)
does a Maven build. Couldn't be more cut and dry.
The 1. above, svn update, does return a latest revision number. I would like to fetch that into 2. so that the build and its associated artifacts do have that number pinned to them, if any way possible in the artifact name itself but, if not, in the build history. Is there a way to do it and how (e.g. using the subversion or another plugin)?
I am using the buildnumber plugin to fetch the build number and generate a small text file that is contained inside my WAR artifacts, which makes it subsequently available via HTTP. But to see it, one must either first deploy the artifact or at least extract its contents. I would like it more readily visible in Jenkins.
You should take a look at How to get SVN revision number in Jenkins Workflow Plugin? - He solved the problem with:
def revision = 'svn info'.execute().in.text.split('\n').find { it.startsWith('Revision') }.split(':')[1].trim()
He's obviously using the latest Jenkins version, but if you're using one of the old Jenkins versions you can simply run the following command and parse the result to get the revision number you want:
svn info -r HEAD
BTW you can use a Jenkins constant too. In the browser you can open http://your-jenkins-host/env-vars.html/ and you will find a constant named SVN_REVISION. Each job build keep the SVN revision into that variable.

Checkout and build project using Jenkins

I have successfully configured the SVN repository url in Jenkins and now i want to build that project through Jenkins, but i want some clarification as i am new to Jenkins.
Can i download the code using Jenkins to my local repository without installing any Subversion software?
If yes, please enlighten me.. If No, may i know the reason or any alternative..
Based on 2 step, i want to build the project(Maven) using Jenkins.. for that i have specified the Root POM option in build step... when i am using the SVN URL to located the POM.xml, it is displaying an error in Jenkins as No such file: ‘http://<POM.xml path>
Please advise, thanks in advance
Build a job with only SCM configured on a machine with no client installed and see what happens. it'll answer your question
Regarding the root pom - you've already checked out your repository, use the local file in your workspace: $WORKSPACE/Path/To/pom.xml
For poll SCM scheduler you can use:
MINUTE HOUR DOM MONTH DOW
MINUTE Minutes within the hour (0–59)
HOUR The hour of the day (0–23)
DOM The day of the month (1–31)
MONTH The month (1–12)
DOW The day of the week (0–7) where 0 and 7 are Sunday.
Example:
*/2 * * * * will run every 2 minutes.

TeamCity pass codebase changes to next build

I have a TeamCity build that sometimes fails too early.
What I mean by that is that the first few steps are for "provisioning" (setting up the testing environment) and the testing of my code itself comes later.
Sometimes (for whatever reason) the build fails during one of the "provisioning" steps. This is not a problem since running the build again usually works fine.
But - the "changes" are not passed along to the next run of the build.
I am using this command as part of my build to output the "changes" that came from my codebase:
copy "%system.teamcity.build.changedFiles.file%" changelog.txt
So I need a way to tell TeamCity "hey, ignore the last run, that failure doesn't count because it didn't test my code, I want the next run to contain the same 'changes' in system.teamcity.build.changedFiles.file"
How can I do that?
Have you tried build chains with dependencies? They can be set up to only execute if the build (including tests) is successful: http://blog.jetbrains.com/teamcity/2012/04/teamcity-build-dependencies-2/

Printing time-stamp after each child module build in Maven

I am building a number of maven projects from the level of their parent.Some of the projects have child modules of their own. Is there a way to print the time-stamp after each module is built?
I suggest using the maven ant-run plugin.
You can add an execution bound the last step (install or deploy) which will print out the time stamp of your choice.
See examples here.
Also you can try the maven exec plugin and just run the system command date (linux) or date /T (windows).
I hope this helps.

Resources