Copying a file before integration using an Xcode Server bot - xcode

I'm setting up a continuous integration (CI) server for our iOS app using Xcode Server. The problem is we have a plist, cred.plist for each person with their credentials and test environment details that is ignored by git and the application will not compile and run without it. There is a file cred_dist.plist that is used to update cred.plist that will work for our CI purposes and I would like to rename/copy it before integration and name it "cred.plist". Both files in the project are in the root directory.
I have tried adding scripts to the CI target and to the bot itself to no avail. Below is an example of an attempt from the bot "Before Integration" script section as well as the error message I receive. I have tried nearly every directory variable I could find including the XCS_ prefix ones, just a slash, and no prefix.
The bot successfully pulls the code from our repo and builds up to the point that the plist is required, then errors.
Any suggestions or help would be greatly appreciated! Thanks!
Script:
#! /bin/bash
cp -a $(TMPDIR)/cred_dist.plist $(TMPDIR)/cred.plist
Error:
Assertion: Reading data: The file cred.plist” couldn’t be opened because there is no such file.
File: MyProject/cred.plist:(null)

After a bit of digging, trial and error, and testing, I believe I have arrived at a solution. The problem is that the XCS_ prefix variable that is closest is XCS_SOURCE_DIR, but that points to where the project is cloned... This means that the path should actually be ${XCS_SOURCE_DIR}/myproject/cred_dist.plist. Below is the script I'm using to perform this task; it runs before the integration - hopefully it will be helpful to someone!
#! /bin/bash
cp -a ${XCS_SOURCE_DIR}/myproject/cred_dist.plist ${XCS_SOURCE_DIR}/myproject/cred.plist

Related

Facing issue regarding installation in hybris6.6

While installing the hybris, my localextension.xml is creating in comment form. I am very new in hybris ecommerce development.
So I have followed below steps for installing the hyrbis -
Installed the zip version of Hybris 6.6
Unzip it
From Platform folder, I opened the terminal and ran ". ./setantenv.sh" And after that I ran "ant clean all" and after the build completed succesfully all folders got created in Hybris folder.
Then I ran "./hybrisserver.sh" and my server got started successfully.
Then I ran "https://localhost:9002/" over that I initialize and it also went successfully.
When I try to access hmc or backoffice it is giving me 404 page not found error.
I checked my localextension.xml file and found all the extensions generated as a comment as shown below.
Could anyone help me out where I am doing the mistake.
Thanks in advance.
If you are using original package you need to install a receipt. Go to install folder.
Run below command for listing existing receipt
./install.sh -l
Prepare b2c with acc:
./install.sh -r b2c_acc
Initialize b2c with acc (Also you can use ant clean all for this step):
./install.sh -r b2c_acc initialize
Start hybris (Also you can use ./hybrisserver.sh start for this step):
./install.sh -r b2c_acc start
When you do "ant all" for the first time and set-up the config folder, it generates a localextensions.xml file which contains extensions that are commented out. If you initialize and start Hybris using this setting, you get nothing, except the HAC.
To enable HMC, you need to at least have "platformhmc" extension enabled (i.e. not commented out) in localextensions. So, stop Hybris, uncomment platformhmc, and do another build (i.e. "ant all"). After that, you can do a Platform Update, or a Platform Initialize (to build from scratch again). When it's done, and you've started Hybris, HMC should be accessible.
Or, if you want more features enabled by default, you can do #mkysoft's suggestion and use recipes.

Run Script with xCode Server Bot

I am running a on-commit Bot to build, analyze, unit tes and archive my App and it works perfectly.
I have a script (*.sh) in my porject that I want to run at the end of a success analysis. I am using xcode 7.3 now and i tried the following:
In the trigger section call ./myscript.sh, but the bot could not find it.
I tried to add $SCROOT, still no luck
I tried to copy the script to bin but since the bot runs under that __xcbuild user it did not see it, and I do not want to mess with adding permission to /bin and /usr/bin
All I want is to run a script against the code the that the bot just pulled on success.
The source used by Xcode CI will be under a cache folder stored in an environment variable called:
$XCS_SOURCE_DIR
Your file should be somewhere under that path

Xcode 6 Continuous Integration Bot - Crashlytics failing on build / upload script

Trying to incorporate Continuous Integration into my Xcode builds.
I have setup OS X Server on my MacBook and everything seems to work fine except for the actual submit/upload script for Crashlytics.
I am getting this error in the 'Trigger' log:
/var/folders/1d/5y5tn0hd1qj01wbxgd3sxrs4000086/T/EFFB7FF5-CFF5-41CF-8AEB-D8813069D831-16127-000004A29A1D79A7: line 2: /Crashlytics.framework/submit: No such file or directory
Couple things to note:
I am able to manually archive/distribute my builds through Crashlytics without any problems.
Crashlytics is installed via PODS and my Run Script looks like this (with my real keys obviously):
${PODS_ROOT}/Crashlytics.framework/submit MYAPIKEY MYCLIENTKEY -emails myEmail#myEmail.com -notesPath ~/Notes/ReleaseNotes.txt -groupAliases myGroupAlias -notifications YES
${PODS_ROOT} is not available to the post trigger action.
You should use
${XCS_SOURCE_DIR}/*RepoName*/Pods/Crashlytics/Crashlytics.framework/submit etc
Where *RepoName* is the name of your repo. Sadly, I haven't been able to find a env variable for it or something.

Jekyll private deployment?

I have created jekyll site. Regarding the deployment I don't want to host on github pages. To host private domain I came know from documentation to copy the all files from _site folder. That's all wicked.
Question:
Each time I add new blog post, I am running cmd>jekyll build then I am copying newly created html to hosted domain. Is there any easy way to update without compiling each time ?
The reason, Why I am asking is because it will updated by non technical person
Thanks for the help!!
If you don't want to use GitHub Pages, AFAIK there's no other way than to compile your site each time you make a change.
But of course you can script/automate as much as possible.
That's what I do with my own blog as well. I'm hosting it on my own webspace instead of GitHub Pages, so I need to do these steps for each update:
Compile on local machine
Upload via FTP
I can do this with a single click (okay, a single double-click).
Note: I'm on Windows, so the following solution is for Windows.
But if you're using Linux/MacOS/whatever, of course you can use the tools given there to build something similar.
I'm using a batch file (the Windows equivalent to a shell script) to compile my site and then call WinSCP, a free command-line FTP client.
WinSCP allows me to store session configurations, so I saved the connection to my server there once.
Because of this, I didn't want to commit WinSCP to my (public) repository, so my script expects WinSCP in the parent folder.
The batch file looks like this:
call jekyll build
echo If the build succeeded, press RETURN to upload!
pause
set uploadpath=%~dp0\_site
%~dp0\..\winscp.com /script=build-upload.txt /xmllog=build-upload.log
pause
The first parameter in the WinSCP call (/script=build-upload.txt) specifies the script file which contains the actual WinSCP commands
This is in the script file:
option batch abort
option confirm off
open blog
synchronize remote -delete "%uploadpath%"
close
exit
Some explanations:
%~dp0 (in the batch file) is the folder where the current batch file is
The set uploadpath=... line (in the batch file) saves the complete path to the generated site into an environment variable
The open blog line (in the script file) opens a connection to the pre-saved session configuration (which I named blog)
The synchronize remote ... line (in the script file) uses the synchronize command to sync from the local folder (saved in %uploadpath%, the environment variable from step 2) to the server.
IMO this solution is suitable for non-technical persons as well.
If the technical person in your case doesn't know how to use source control, you could even script committing & pushing, too.
There are a number of options available which are mentioned in the documentation: http://jekyllrb.com/docs/deployment-methods/
If you are using Git, I would recommend the Git Post-Receive Hook approach. It simply builds the site after the new code is received:
GIT_REPO=$HOME/myrepo.git
TMP_GIT_CLONE=$HOME/tmp/myrepo
PUBLIC_WWW=/var/www/myrepo
git clone $GIT_REPO $TMP_GIT_CLONE
jekyll build -s $TMP_GIT_CLONE -d $PUBLIC_WWW
rm -Rf $TMP_GIT_CLONE
exit
Since you mentioned that it will be updated by a non-technical person, you might try something like rack-jekyll to automatically rebuild when new files are FTP'd.

How to use the log file in Server with Xcode 5 continuous integration (CI, bots)

I have scripts set up to run as post- and pre-actions in my Xcode project's scheme. printf and puts in Ruby don't seem to print to the logs that show up on the Xcode continuous integration website's "Logs" tab. How can I print to this log file? Also, is there a way to find out where the log file is located?
Please forgive my naivety: I know very little about how OS X Server works. The Xcode CI web interface is the only place I can see the log file:
Note, this is a cross-post from: https://devforums.apple.com/message/908997#908997
Yes, writing to /tmp is what worked for me, here is an exerpt from one of my scripts:
exec > /tmp/testflight.log 2>&1
echo "uploading to testflight"
On the server running the xcode bot, your file should be there in /tmp as specified. I did not receive the permissions errors so maybe this will work for you.

Resources