Firebase crash batch upload fail for unknown reason - ios

I'm trying to upload DSYM s to firebase, which worked perfectly till a few days before. When I start the script, and it s start loggin, a few lines after it stuck for a few minutes and then fails.
/Users/..../dSYMs/DF...C47.dSYM/Contents/Resources/DWARF/leveldb: warning: function at offset 0x51662 has no name
./Pods/FirebaseCrash/upload-sym-util.bash:365: error: upload: Unable to upload symbol file (reason unknown).
The interesting thing is, in firebase console it tells me the upload was successful:
Future stack traces for UUID B4...AAF will
be symbolicated using the uploaded symbol file.
But it never, because I ve "uploaded" a few like this, and since that, I had a few more crashes, but still not symbolicated...
What's going on?
FYI: I'm using firebase crashreporting since February, and it worked nicely. I updated my mac to High Sierra a few days ago.
Thy

TL;DR
Look for the following line in upload-sym-util.bash:
HTTP_STATUS=$(curl ${CURLOPT} -sfL -H 'Content-Type: text/plain' -H "Authorization: Bearer ${BEARER_TOKEN}" -w '%{http_code}' -T "${FILE}" "${UPLOAD_URL}")
And append --http1.1 at the end so that it becomes:
HTTP_STATUS=$(curl ${CURLOPT} -sfL -H 'Content-Type: text/plain' -H "Authorization: Bearer ${BEARER_TOKEN}" -w '%{http_code}' -T "${FILE}" "${UPLOAD_URL}" --http1.1)
Explanation
We have been having this issue when uploading the DSYM files on Firebase via XCode. What was driving us crazy was that the process seemed to randomly succeed and fail. When the upload failed, it did after a few minutes.
We managed to run the offending curl command manually and discovered that it was returning an HTTP status code of 000 which seems to happen when the connection is closed before the server actually returns anything (eg: timeout). By using the --verbose argument we discovered that curl was aborting the call with an INTERNAL_ERROR (err 2) which seemed to be linked with the use of HTTP/2. We managed to confirm this when we found out that the only machine that was able to upload the DSYM files correctly had the same version of curl as everyone else but with no HTTP/2 support, which was apparently added in High Sierra. We forced curl to use HTTP1.1 and it did the trick.

Related

How to download a huge console output from Jenkins

My job executes ansible-playbook in debug-mode (ansible-playbook -vvv) which generates a lot of output.
After the job finished, its very difficult to search using browser because its very slow and stuck.
I tried to download it with curl/wget, but the file is incomplete (i guess only about 10% was downloaded)
curl http://j:8080/job/my-job/5/consoleText -O
wget http://j:8080/job/my-job/5/consoleText
curl returns with error:
curl: (18) transfer closed with outstanding read data remaining
Try the following.
curl -u "admin":"admin" "http://localhost:8080/job/my-job/5/logText/progressiveText?start=0"
If that doesn't work. I think your best option is to get the log from the server itself. The log can be found at ${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_NUMBER}/log.

twilio. An error occurs when deploying with plugin

If you deploy using the command below,
twilio flex:plugins:deploy --changelog='first deploy'
The following error will occur.
I don't understand the meaning of the path pointed to by resource.
Error code 20404 from Twilio: The requested resource /Services/ZSXXXXXXXXXXXXXXXXXXXXXXX/Environments was not found. See https://www.twilio.com/docs/errors/20404 for more info.
This is the first deployment that has not been deployed yet.
What should i do?
twilio serverless:deploy
Using the above command, functions and assets are deployed on a serverless basis.
At that time, I have deleted the Services of functions and assets that existed by default.
Is this default Services relevant for plugins?
Also, if it is related, where is the part to reset in the plug-in?
When I contacted support, they told me to run the reset command.
curl https://flex-api.twilio.com/v1/Configuration \
-H "Content-Type: application/json" \
-d '{"account_sid":"ACCOUNT_SID", "serverless_service_sids": []}' \
-u ACCOUNT_SID:AUTH_TOKEN
If you deploy again after executing the above command
I was able to deploy without problems.

How to fail a AppCenter build on script exit code?

I've got a bunch of scripts that get called when the appcenter-pre-build.sh is called. For example, one of them is a simple check to see if the current branch tag already exists on the repository.
#!/usr/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status (failure)
# 1 Fetch tags
git fetch --tags
# See if the tag exists
if git tag --list | egrep -q "^$VERSION_TAG$"
then
echo "Error: Found tag. Exiting."
exit 1
else
git tag $VERSION_TAG
git push origin $VERSION_TAG
fi
If the tag is found, I want to abort the build in AppCenter and fail it. This worked perfectly fine when I was running everything through Xcode Server but for some reason, I cannot figure out how to abort the build upon failure of my script. I'm not seeing much documentation on this particular subject and the AppCenter folk over at Microsoft are taking their sweet time getting back to me.
Anyone have experience with this and/or know how to fail an AppCenter build from their scripts? Thanks in advance for your thoughts!
Okay, figured it out. Looks like sending a curl request to cancel the build using the env variable "$APPCENTER_BUILD_ID" takes care of the issue. Exiting your script with a non-zero is NOT working inside AppCenter.
Here's a sample of what to do. I just put it in a special "cancelAppCenterBuild.sh" script and called it in place of my exits.
API_TOKEN="<YourAppToken>"
OWNER_NAME="<YourOwnerOrOrganizationName>"
APP_NAME="<YourAppName>"
curl -iv "https://appcenter.ms/api/v0.1/apps/$OWNER_NAME/$APP_NAME/builds/$APPCENTER_BUILD_ID" \
-X PATCH \
-d "{\"status\":\"cancelling\"}" \
--header 'Content-Type: application/json' \
--header "X-API-Token: $API_TOKEN"
Pro tip: If you've ever renamed your app, AppCenter servers are having issues referencing the new name. I was getting a 403 with a forbidden message. You might have to change your app name to whatever the original name was or just rebuild the app from scratch within AppCenter.

Webhook for iTunes Connect crashes?

I am able to get the crashes when I go to Xcode -> Window -> Organizer -> Crashes:
I was wondering, if it is possible to get a webhook whenever a crash gets sent to itunes (not other crash reporting like Crashlytics, Hockeyapp, etc.), that way I can get real time notifications using Slack whenever a production crash occurs.
Is this feasible? My only concern is that provisioning profiles and credentials will block me from doing so. I haven't been able to find any resources online for this issue.
If one traces http activity whilst downloading crashes on the Xcode Organizer, one can see that GET commands are made to http://crashwebservices.apple.com
Right click on Charles to Copy cURL Request and the command is executed succesfully in Terminal.
Having removed sensitive information, it looks something like this:
curl -H 'Host: crashwebservices.apple.com' -H 'X-Apple-I-Identity-Id: myIdentityId' -H 'User-Agent: Xcode' -H 'X-Apple-GS-Token: myToken' -H 'X-Apple-I-MD-LU: myMDId' -H 'X-Apple-App-Info: com.apple.gs.xcode.auth' -H 'X-Mme-Device-Id: myDeviceId' -H 'X-MMe-Client-Info: <MacBookPro11,3> <Mac OS X;10.13.2;17C205> <com.apple.AuthKit/1 (com.apple.dt.Xcode/13772)>' -H 'X-Apple-I-TimeZone: CET' -H 'X-Apple-I-Client-Time: 2018-02-02T08:43:21Z' -H 'X-Xcode-Version: 9.2 (9C40b)' -H 'Accept-Language: en-gb' -H 'X-Apple-I-MD-RINFO: 17106176' -H 'X-Request-ID: myRequestID' -H 'Accept: application/json' -H 'X-Apple-I-MD-M: myMDM' -H 'X-Apple-I-Locale: en_GB' -H 'X-Apple-I-MD: myIMD==' --compressed 'https://crashwebservices.apple.com/api/v2/crashpoint/816170169/com.myappbundleid/2.2.0/2.2.0/iOS/someOtherId?isBeta=false&startDate=2018-01-19&endDate=2018-02-02'
A load of data is returned. Most likely all the crash logs.
There will be some authentication handshake first with iTunes Connect credentials passed to return a session cookie. In theory you could dig into this and probably have something working.
Finally, looks like you - and I - aren't the first to consider this. See Crashes Organizer - Crash Web Services. Looks like this has since evolved into Spaceship, which is now part of fastlane tools. Haven't tried it but definitely worth investigating to see if it does everything you need.
No bounty worthy answer: I dont think so. It'd be a cool hack (very cool) but I dont there is any public api

How to list Docker images in a Codefresh private registry?

I'm currently using Codefresh's free private registry to store my images. I am using CircleCI for my Docker builds, so from there I use docker login so I can push and pull to the Codefresh registry. This works fine. However, Codefresh only lists images in its web app for which it did the building, so I cannot easily see a catalogue of them. I suspect this is by design, so that users stick with Codefresh for CI. However, if possible, I would like to list the images I have in the registry.
I assume that this registry is a basic v2 version of the standard Docker Registry. So, I have had a hunt around, and found this console utility to manage images. However, it does not seem to work for me. I don't know whether this is because registry management tools are still immature generally (web searches indicate they were added much later, and there are lot of folks for whom this simple task has become a substantial undertaking) or whether there is something unusual with Codefresh.
Here is what I am trying:
reg -d -r r.cfcr.io -u myusername -p cfaccesstoken
(The -d is for debug).
This results in:
2017/10/18 11:24:43 registry.ping url=https://r.cfcr.io/v2/
2017/10/18 11:24:44 registry.catalog url=https://r.cfcr.io/v2/_catalog
2017/10/18 11:25:53 registry.catalog url=https://r.cfcr.iohttps://r.cfcr.io/v2/_catalog?n=1000&last=davigsantos/davigsantos/codeflix
FATA[0075] Get https://r.cfcr.iohttps//r.cfcr.io/v2/_catalog?n=1000&last=davigsantos/davigsantos/codeflix: dial tcp: lookup r.cfcr.iohttps on 127.0.1.1:53: no such host
The penultimate line contains a container name I don't recognise - I hope it is a public one, and not one I should not be seeing!
The last line indicates some sort of fatal error, with all sorts of URL fragments mashed together in ways that definitely won't work.
I have also discovered that dropping the access token makes no difference; the output is exactly the same:
reg -d -r r.cfcr.io -u myusername
What else can I try? I am running Mint Linux and would be fine with swapping to another utility if necessary. Is there something wrong about the way I am issuing this command, or is Codefresh running a non-standard registry that is incompatible with standard API calls?
Update
It looks like Codefresh also has their own API, though it does not seem to be documented as far as I can tell. Running the get operation produces this error:
Failed to authenticate request because no token was provided
That's encouraging, so I will try to find out how to provide a token in a curl call; the Swagger web interface does not seem to permit it. However I am conscious that, if I can get the API working, it may not list my Docker images anyway, since they were not built by Codefresh.
Update 2
I have found some articles on the Codefresh blog that hint how to authenticate on the API, the format is a header thus:
--header "x-access-token: (token)"
However I get this error:
{"status":401,"code":"2401","name":"UNAUTHORIZED_ERROR","message":"Failed to authenticate request because token is not valid","context":{}}
The token I am using is the same one as I use for docker login, which works. I notice I was not specifying my username, so I am also adding this curl option:
-u (user):(token)
As you can see, I am close to trying random things now, as there does not seem to be official help online.
Update 3
Prompted by a comment below, it seems that Docker maintains an access token after login is used, in ~/.docker/config.json.
I therefore tried this:
reg -d -r r.cfcr.io -u myusername -p dockeraccesstoken
(Note how cfaccesstoken has been changed to dockeraccesstoken).
This returns much more quickly now (as opposed to appearing to hang), but returns nothing:
2017/10/24 10:56:16 registry.ping url=https://r.cfcr.io/v2/
2017/10/24 10:56:18 registry.catalog url=https://r.cfcr.io/v2/_catalog
Repositories for r.cfcr.io
You need to first generate a token on CodeFresh User Settings
Next I will show you how to login from terminal
curl -H 'Host: r.cfcr.io' -H 'User-Agent: ItsMe' -H 'Authorization: Basic <AUTH>' --compressed 'https://r.cfcr.io/v2/token?account=xxxx&scope=repository%3A<user>/<name>%3Apush%2Cpull&service=r.cfcr.io'
You can get the <AUTH> by running
echo <account>:<token> | base64
This will return you a big token
{"expires_in":43200,"issued_at":"2017-10-24T03:34:54.118390368-07:00","token":"APMm...P91"}%
Now you can use that token to make a docker API call
$ curl -IH 'Host: r.cfcr.io' -H 'User-Agent: ItsMe' -H 'Authorization: Bearer APMm+...aRL' -X HEAD 'https://r.cfcr.io/v2/<user>/<user>/testci/blobs/sha256:c7fefcc4c54c63f32b5422ede095793eb5ff0f45ad7a22861974ec9b61e7749b'
HTTP/1.1 200 OK
Docker-Distribution-API-Version: registry/2.0
Content-Length: 22488057
Date: Tue, 24 Oct 2017 10:42:23 GMT
Content-Type: text/html
Server: Docker Registry
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
For registry search access below should have worked
curl -H 'Host: r.cfcr.io' -H 'User-Agent: ItsMe' -H 'Authorization: Basic ' --compressed 'https://r.cfcr.io/v2/token?account=xxxx&scope=registry%3Acatalog%3Asearch&service=r.cfcr.io'
But it doesn't and neither does registry:catalog:* for scopes. This is like hitting a target with blind folds and not even knowing in which direction we stand. You best bet is to get them to disclose some information to you
Edit-1: Getting the catalog
So I finally managed to crack it, but the result is a bit unfortunate. I ended up getting catalog/repositories of every single user. I checked, you still can't pull those repo. So their docker images are safe as such. These look like so:
Edit-2: Fetching all repos
After we notified Codefresh of this situation, here is how to do the fetch. One needs to first generate a token using below:
curl -H 'Host: r.cfcr.io' -H 'User-Agent: MyAgent' -H 'Authorization: Basic .....' --compressed 'https://r.cfcr.io/v2/token?account=<account>&service=r.cfcr.io'
And then using the same we can query the complete catalog:
curl -H "User-Agent: ItsMe" -H 'Authorization: Bearer <TOKEN>' 'https://r.cfcr.io/v2/_catalog?n=10' --compressed
I have a partial answer, and I think it is useful enough on its own for others approaching the same difficulty. I got some kind assistance via the chat widget on Codefresh's support page.
Proprietary API
Regarding the Codefresh API, I had not spotted that the domain g.codefresh.io is the same as their control panel. So, to authenticate, all I had to do was log into the control panel - oops! That reveals the call to https://g.codefresh.io/api/images and a much more complicated access token than I've been using - perhaps it is OAuth. It looks like this:
curl \
-X GET \
--header "Accept: application/json" \
--header "x-access-token: (36chars).(143chars).(22chars)-(4chars)-(15chars)" \
"https://g.codefresh.io/api/images"
As I considered in the question, it does look like the /api/images endpoint is for Codefresh builds only. So, this is out for me - I want everything in the registry.
Open API
So, turning to Docker's open standard for accessing registry, my support contact said this:
if you want to connect to cfcr.io through docker CLI, you can.
The username is your username at Codefresh. The password is a token you can generate at user settings -> "GENERATE" button at the Codefresh registry section.
That's what I've been doing so far, and it works for login, push and pull. It does not seem to work for the reg utility in ls mode though. Either I am still doing something wrong, or there are restrictions at Codefresh as to how the private registry may be used.
Unfortunately, it's not possible to use search and catalog commands for Codefresh Registry. The Codefresh registry (r.cfcr.io) is based on Google Container Registry (aka GCR) and Google Registry does not implement v1 Docker registry API and _catalog function.
Once they do, things will work for Codefresh Registry too.

Resources