How do you configure Xcode Server (Bot) to only keep the n most recent integrations? - xcode7

We've recently discovered that Xcode Server (i.e. a Bot) will keep all past integrations. (We discovered this as the builds started failing and we realized the CI server was completely out of disk space).
How can you configure a bot (or the server in general) to only keep the last n integrations? Or even the last n days?
If there is no built-in setting, is there a way to accomplish this via a cron job that doesn't have to use the unofficial XCode Server API?

The current max disk size is a ratio of 0.75 of the capacity (if I understand the output well). You can see it for yourself if you run curl -k -u USER:PASS https://localhost:20343/api/settings. You might be able to change it by calling this API as a PATCH request with a modified value for max_percent_disk_usage to something smaller and then giving it time to clean up. I haven't tested that however.
If you're interested in how this works, see /Applications/Xcode.app/Contents/Developer/usr/share/xcs/xcsd/routes/routes_setting.js line 19. From there you should be able to dig deeper and see for yourself.
Hope this helps.

This was very helpful, #czechboy!
The JSON document returned when you fetch the settings will contain the _id of the xcode instance whose settings you wish to modify, and you must send the PATCH request to https://localhost:20343/api/settings/<id>. The body of the request should be something like:
{ "set_props": { "max_percent_disk_usage": 0.40 } }
After doing this I needed to restart the server before old files were cleaned up.

Related

OMA firmware update using Leshan server: Where to save the files?

I'm quite new to the world of the IOT (protocols). I want to update some devices remotely (they will be installed about 8000km away from my working place). I have found out that LWM2M would fit to my scope.
Because the internet connection there is not stable and the bandwidth is low, I have decided to also install a Raspberry Pi to collect the data of the sensors and to install a Leshan server to trigger the updates.
I have tested the devices and I can register them to the Leshan server on the Pi, read some data, and reboot the devices. The problem is, I don't know where to save my binary file for the update, so that the device can download them.
I tried following steps:
Save the file on [leshan-dir]/update.bin.
Write the "Package URI": coap://[raspi-IP]:5683/update.bin
After that, the backgroud color of the button "Write" changes to green.
Execute the update
The response of the server is 404 [Not Found].
I have looked for any API to find out where I can save the .bin file, but without success. And because nobody seems to have had a similar error, I start thinking I have missed some points.
Where do I have to save the files on the Raspbery Pi, so that I can perform an update?
I found a solution for the problem I exposed above.
I use from the californium-project the demo-app cf-simplefile-server (Ref. https://github.com/eclipse/californium/tree/2.0.x/demo-apps/cf-simplefile-server)
Note: You have to checkout to the git-branch 2.0.x to use it.
To run the leshan server and the file-server on the same machine I had to change the port of one of the server using the file Californium.properties.
I decide to change the ones of the file-server to 5685 and 5686
When both server runs I can insert in Package URI something like:
coap://[[ip_of_the_pi]]:5685/data/[[name_of_the_firmware_file]]
Probably there are better solution for it, but for a coap/lwm2m beginner like it works very well.
Note: If you have bigger file to transfer you can also change the property MAX_RESOURCE_BODY_SIZE
I hope this may help somebody.
Regards,
Elvys

chrome "aw, snap" crash, but can't see crash log in chrome://crashes but see DMP generated, so what is the quickest way to interpret this DMP file

I can see my page get crash(see aw, snap page) with 20% proprobility after 10 mins(otherwise it runs well like forever)
so I tried:
1) CPU and memory check with task manager, and see no increasing(so no leakage).
2) enable crush log in the chrome://settings/
result:
2.1) see still nothing in the chrome://crashes page, not even a crush ID (0 crashes).
2.2) see nothing in the folder under path
C:/%User%/AppData/Local/Google/CrashReports (nothing in) nor
C:/%User%/AppData/Local/Google/Chrome/User Data/Crash Reports (folder not exist)
2.3) but indeed see DMP in the:
C:/%User%/AppData/Local/Google/Chrome/User Data/CrashPads/reports
but seems they are not readable, and it also seems not the correct address for crash logs
3) can get chrome log either by command line arguments, or using sawbuck, but found nothing but only 2 errors, one for sawbuck itself, and another saying can't send the report to google.
So the questions are:
1) are those DMP the crash logs(the default Dir for dump file has been changed for chrome v50)
2) how can I abstract information out of the DMP file, if chrome://crashes page shows nothing (for chrome on windows)
p.s. 2 usage pages are found at https://www.chromium.org/developers/decoding-crash-dumps
https://www.chromium.org/developers/crash-reports
but seems it's not for windows without a recompile of chrome's component, is there any 3rd party tools to interpret the DMP file?
env informations:
chrome version: 50.0.2661.02 m
; Host OS: windows 10
The crash dumps (.dmp files) in C:\Users\<user>\AppData\Local\Google\Chrome\User Data\Crashpad\reports can be read by standard Windows debuggers. WinDbg is one tool (provided by Microsoft) for analysing these dumps; it's not going to win any beauty contents, but it's powerful and gets the job done. The recommended way to obtain it is, somewhat bizarrely, the Windows Driver Kit.
You'll need debugging symbols to make sense of the results, and these aren't included in standard builds of Chrome. To get symbols for both Chrome and the Windows runtime, set the following as your Symbols path:
SRV*c:\symbols*https://msdl.microsoft.com/download/symbols;SRV*c:\symbols*https://chromium-browser-symsrv.commondatastorage.googleapis.com
There are numerous resources on using WinDbg on the web; this cheat sheet contains some useful commands to get you started.

Fetching previous revisions of multiple files via Google Drive API?

While trying to import some Android projects into Eclipse, I have noticed that every file in the project is 0 bytes after they are imported. These projects are stored on Drive, so there is some chance of reverting them back to the previous version.
Reverting files to previous versions is easy to do when you've got a few files - you simply do it through a browser. However, I have hundreds of files and I need to fetch one revision back for each. I have been able to download a number of files by hand thus far, but there has to be a better way.
I have asked Google support and actually got a response back, but it's clear that there is no built-in functionality to do this. So I have started looking at the Drive API but I can see that there might be a bit of a learning curve.
Wondering if anyone has run into this before? Ideally I would like to identify one folder and for each file underneath, fetch the last version of the file. If anyone has a good approach for this, I would love to hear it.
thanks!
The pseudeo code to do what you want is
# get the id of the folder https://developers.google.com/drive/v2/reference/files/list
fid=file.list(q=title = 'foo')[0]
# get the children of that folder https://developers.google.com/drive/v2/reference/children/list
children = file.children(fid).maxresults=999
# for each child,
for id in children.id
# get the revisions https://developers.google.com/drive/v2/reference/revisions/get
revisions = file.revisions(id)
# iterate, or take item[1] whatever works best for you, and use its downloadUrl to fetch the file
With each call that you make, you'll need to provide an access token. For something like this, you can generate an access token using the oauth playground https://developers.google.com/oauthplayground/
You'll also need to register a project at the cloud/api console https://code.google.com/apis/console/
So ye, it's a disproportionate amount of learning to do something fairly simple. It's a few minutes work for somebody familiar with drive, and I would guess 3 days for somebody who isn't. You might want to throw it up on freelancer.com.

Verify a Tif with ApprovalTests

I have been asked to update a system where header information gets injected into a tif via a 3rd party console application. I don't need to worry about that bit.
The part I have been asked to look at it the merge process that generates the header information.
The current file generated by the process is assumed as correct, before I make any changes, so I want to add this as an approved result, from that I can then check that the changes I make will alter the file as expected.
I thought this would be a good opportunity to look at using ApprovalTests
The problem I have is that for what ever reason the links to the videos are considered corruptible (Possibly show me kittens jumping into boxes or something, which will stop me working, which ironically means I slow down my work done because I cannot see any help videos).
What I have been looking at is the Approvals.Verify and Approvals.VerifyFile extensions.
But what appears to be happening is confusing me.
using VerifyFile creates a received file, but the contents of the file are just a line the name of the file I have asked it to verify.
using Verify(new FileInfo("FileNameHere")) does not appear to generate the received file that I need to flag as approved, but the test does return saying that it cannot find the approved tif file.
I am probably using VerifyFile completely wrong and might be looking at using Verify wrong as well.
useful info?
Might be useful to know, that as this is a legacy application, running as a windows service, I have wrapped the service in a harness that allows me to call the routines, so the files are physically being written elsewhere on the machine outside of my control (well there is a config, but the return of the service I call generates a file in a fixed location if it is successful). I have tried copying that into the Unit Test project, but that doesn't appear to help.
Verify(File) and VerifyFile(string) are both meant to verify an existing file. As such they merely setting the received file to the file you pass in. You will still need to move/approval/create the approved file.
Here is the pseudo code and process.
[UseReporter(typeof(DiffReporter), typeof(ClipboardReporter)]
public void TestTiff()
{
string tif = YourProcessToCreateTifFile();
Approvals.VerifyFile(tif);
}
[Note: if you don't have an image diff installed, like TortoiseDiff, you might want to use the FileLauncherReporter]
Run this, once you get the result, move the file over by pasting your clipboard into a cmd window.
It will move the temporary tif to your test directory with the name ClassName.TestTiff.approved.tif
After that the test should pass until something changes.
Happy Testing!

how to get changed files from TFS using nant

It is really painfull to get all code form TFS whenever you make a build using NANT.
Is there any settings in ccnet.config which will only take the files which are changed form last time which can speed up the process.
The "get" process will only actually download files that are different than the version in the workspace, unless you are specifying a /force which will force it to get the specified version even if TFS thinks it has that version in the workspace.