Having a shell script refer to XCode build paths - xcode

I have a shell script that runs lcov (test coverage) on an iOS project that I have Hudson. Hudson's copy of this project is derived from a Git repository. The way that I have set up now is that whenever the repo is updated or if someone manually builds the project in Hudson, Hudson would automatically run the app, and then run my shell script after the build is done. lcov can only be run after the app is not only built, but automatically run with some functional test tools. So, I cannot run the shell script as part of the build process, through XCode. It must be run after the app finishes building and running.
However, I would like to use this project in multiple Hudson jobs. Unfortunately, in each Hudson job, the iOS project is named differently. I would like to refer to the build path with some sort of environmental variable, but I don't know how to. Does anyone have any tips as to how to find that?

If I understand you correctly this is really a Hudson question. You can set "global variables" in your Hudson config and then invoke shell scripts, batch files, ant builds etc. You can also set them dynamically on each invocation of your Hudson job. Not sure exactly how to help you in your specific environment without more info.

Related

SVN commit using Jenkins

I recently created an automated process to run multi-step Maven builds for my organization. They now are looking to have the entire process automated using Jenkins. I have been able to successfully create branches, builds, change versions, etc., using Maven commands but I am having difficulty committing the version changes (1.0.1-Snapshot to 1.0.1-E1 for example) with Jenkins. I have tried using basic commands like:
SVN commit "Comments"
However, Jenkins does not seem to know what to do with these command lines in the "Execute Windows Batch File" Post Build option. I simply receive build failures caused by the batch file for "unknown reasons." I see the help desk I am working with has installed the Subversion plugin, but perhaps something else is missing. I know that when I use the command prompt locally I need to use something like this:
"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe"
/command:commit /path: /url:
However, Jenkins is hosted by a third party and I do not have direct access to the servers so I would not be able to implement that kind of path data. So I am now looking to see if I can run this, somehow, purely through Jenkins as my client requests.
Anyone have any success with SVN Commit to update version changes through Jenkins?
Thanks!
-Cameron
Why did you decide to run TortoiseProc via Jenkins? TortoiseProc is not the right tool for this task, use svn.exe client.
TortoiseProc can be used for TortoiseSVN's GUI automation, but this case is completely different to running Jenkins.

Where does Jenkins store the project source

I have a Jenkins job that uses a script to build my project. On the following line, the script fails mvn -e -X -Dgit='$git' release:prepare.
Because I want to search for the cause of this, I want to go to the Jenkins server and run mvn -e -X -Dgit='$git' release:prepare from the command line, to see if it works.
Does Jenkins store the projects' source code somewhere, such that I can go to that folder and call Maven?
If yes, then where?
Yes, It Stores the project files for the job by default at
/var/lib/jenkins/workspace/{your-job-name}
This is where jenkins suppose the project files to be present or it pulls it from a source before start working/building from it.
Quote from Andrew M.:
"Hudson/Jenkins doesn't quite work that way. It stores configurations and job information in /var/lib/jenkins by default (if you're using the .deb package). If you want to setup persistence for a specific application, that's something you'll want to handle yourself - Hudson is a continuous integration server, not a test framework.
Check out the Wiki article on Continuous Integration for an overview of what to expect."
From this Question on serverfault.
This worked for me:
/var/jenkins/workspace/JobNameExample
but, if your build machine (node) is a different than the one where Jenkins is running (manager), You need specify it:
/var/jenkins/workspace/JobNameExample/label/NodeName
Where you can define label too:
jenkins stores its workspace files currently in /var/jenkins_home/workspace/project_name
I am running from docker though!

Xcode 6 running custom shell scripts

When I build my target, in the information tab I can see the scheme building and the target building. At the end of the process it runs 2 custom shell scripts.
I can't find where the target or project is running these 2 custom shell scrips. I've looked at target > build phases and it's not being set to run there. I also looked at project > build settings but I can't locate it there.
I don't want to run these scripts but I don' know how to remove them! Any help would be great! Thanks
yup but I know the pods project or targets are not set to run scripts. I've inherited this project on our jenkins it runs 2 scripts at the end of the build. I've removed it from jenkins but not sure how to remove it from the project.
Pods run scripts. Here's the two scripts being run:
If you don't want to use pods anymore, use this pods-deintegrate plugin to remove all traces of pods.

Execute Shell Script after post build in Jenkins

I am trying to execute a shell script if either the build pass or fails after post-build in Jenkins. I cannot see this option in post build to execute some shell script except for running a target.
Very easily done with Post build task plugin.
You can also run arbitrary commands using the Groovy Post Build - and that will give you a lot of control over when they run and so forth. We use that to run a 'finger of blame' shell script in the case of failed or unstable builds.
if (manager.build.result.isWorseThan(hudson.model.Result.SUCCESS)) {
item = hudson.model.Hudson.instance.getItem("PROJECTNAMEHERE")
lastStableBuild = item.getLastStableBuild()
lastStableDate = lastStableBuild.getTime()
formattedLastStableDate = lastStableDate.format("MM/dd/yyyy h:mm:ss a")
now = new Date()
formattedNow = now.format("MM/dd/yyyy h:mm:ss a")
command = ['/appframe/jenkins/appframework/fob.ksh', "${formattedLastStableDate}", "${formattedNow}"]
manager.listener.logger.println "FOB Command: ${command}"
manager.listener.logger.println command.execute().text
}
(Our command takes the last stable build date and the current time as parameters so it can go investigate who might have broken the build, but you could run whatever commands you like in a similar fashion)
If I'm reading your question right, you want to run a script in the post build actions part of the build.
I myself use PostBuildScript Plugin for running git clean -fxd after the build has archived artifacts and published test results. My Jenkins slaves have SSD disks, so I do not have the room keep generated files in the workspace.
You should be able to do that with the Batch Task plugin.
Create a batch task in the project.
Add a "Invoke batch tasks" post-build option selecting the same project.
An alternative can also be Post build task plugin.
You'd have to set up the post-build shell script as a separate Jenkins job and trigger it as a post-build step. It looks like you will need to use the Parameterized Trigger Plugin as the standard "Build other projects" option only works if your triggering build is successful.

what's the best way to automate post-build actions?

We use Luntbuild to do our builds. Our project builders are in Maven 2. After each build is done we need to do a lot of cd, mkdir, cp, unzip rm and zip commands. We currently have a shell scrip that does this but we need to wait for a successful build and then manually run that script. Is there a way to set luntbuild to do the post-build actions for us as soon as it gets a successful build.
If so what should the format of the post-build script be? and how do i set it up?
You may want to run your script via the maven invoker plugin. There is also an example on their site.

Resources