Firebase app distribution via Fastlane "the server responded with status 403" - bash

I setup Firebase app distribution feature in Fastlane Fastfile to distribute beta version of my iOS app. It was working fine but It suddenly started showing errors.
This is how my lane looks like.
lane :distribute_beta do |options|
sync_code_signing_adhoc()
update_build_number_of_all_frameworks()
build_ios_app_adhoc()
firebase_app_distribution(
app: "<app ID here>",
testers: "<tester emials here>",
release_notes: options[:release_note],
firebase_cli_path: "/usr/local/bin/firebase"
)
end
When I run this lane it shows error
the server responded with status 403
on Step: firebase_app_distribution
Log also says authentication to google succeeded.
Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: /<path to cred>/<cred_file_name>.json
🔐 Authenticated successfully.
Following is entire error around "Step: firebase_app_distribution "
[17:11:04]: ---------------------------------------
[17:11:04]: --- Step: firebase_app_distribution ---
[17:11:04]: ---------------------------------------
[17:11:04]: Authenticating with GOOGLE_APPLICATION_CREDENTIALS environment variable: /<path to cred>/<cred_file_name>.json
[17:11:04]: 🔐 Authenticated successfully.
+------------------------------------+---------------------------------------------+
| Lane Context |
+------------------------------------+---------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios distribute_beta |
| SIGH_PROFILE_TYPE | ad-hoc |
| MATCH_PROVISIONING_PROFILE_MAPPING | {"<my bndle ID>"=>"match AdHoc |
| | <my bundle ID>"} |
| BUILD_NUMBER | 107 |
| IPA_OUTPUT_PATH | /Users/my_user_name/Repository/App/App|
| | y/App.ipa |
| XCODEBUILD_ARCHIVE | /Users/my_user_name/Library/Developer/Xcode/A|
| | rchives/2021-01-08/App 2021-01-08 |
| | 17.09.08.xcarchive |
| DSYM_OUTPUT_PATH | /Users/my_user_name/Repository/App/App |
| | y/App.app.dSYM.zip |
+------------------------------------+---------------------------------------------+
[17:11:06]: the server responded with status 403
+------+-----------------------------+-------------+
| fastlane summary |
+------+-----------------------------+-------------+
| Step | Action | Time (in s) |
+------+-----------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | Switch to ios | 0 |
| | sync_code_signing_adhoc | |
| | lane | |
| 3 | sync_code_signing | 18 |
| 4 | Switch to ios | 0 |
| | update_build_number_of_all | |
| | _frameworks lane | |
| 5 | increment_build_number | 1 |
| 6 | commit_version_bump | 0 |
| 7 | Switch to ios | 0 |
| | build_ios_app_adhoc lane | |
| 8 | build_ios_app | 126 |
| 💥 | firebase_app_distribution | 1 |
+------+-----------------------------+-------------+
[17:11:06]: fastlane finished with errors
How can I fix this?

Usually, when you get that specific message it means that the Firebase Refresh Token is no longer valid.
So, when you submit the app, at some point, you have to specify the Firebase Refresh Token:
...
firebase_app_distrubution(
...
firebase_cli_token: "<YourFirebaseRefreshToken>"
)
...
You can get this token from here. If your script started to fail out of nowhere, that probably means that whoever generated this (or any other authentication token) got removed from the Firebase project.
If you're getting a 403 that definitely means that either someone got removed from your Firebase project or that someone removed/regenerated a token on the Firebase console.

Simply run the following command on console:
curl -sL https://firebase.tools | bash
then, authenticate on the browser
Then run
firebase login:ci
After success you will get printed your new cli token, like this:
Waiting for authentication...
✔ Success! Use this token to login on a CI server:
1//here_will_be_your_new_token
Example: firebase deploy --token "$FIREBASE_TOKEN"

As for me, it was because the service account that I am using does not have Firebase App Distribution Admin role. https://firebase.google.com/docs/app-distribution/authenticate-service-account?platform=ios
I simply had to edit my existing service, to do that, go to firebase console > project settings > Service accounts > then click on the service accounts as shown in the image below
It will take you to GCP IAM and Admin where you can find and edit the role of your service account.

For me, I had to add the particular account I was using for App Distribution login to the Project settings for my app.

Check that your firebase account have distribution permission for project.
Project settings -> Users and permissions -> Member should be with "Editor" role

Related

How to build a module from another api service module in Spring boot (Gradle build)

I'm working on a Spring Boot app with multiple modules and using Gradle build tool. I'm trying to build my 'script' module from a service pack of 'api-service' module. Tried Gradle build command with windows command executor using 'async' function but found no result. My project structure looks like:
parent
|
+ build.gradle
|
+ settings.gradle
|
+ api-service
| |
| + build.gradle
|
+ script
| |
| + src
| | |
| | + test
| | | |
| | | + groovy
| | | | |
| | | | + Test.groovy
| + build.gradle
Here want to build the module or run the Test.groovy using gradle script from api service module. Is there any to do it? Please share your valuable ideas.

Getting latest version of Android from sdkmanager automatically

I was trying to make a bash script to automatically install flutter and android sdk without Android Studio.
I managed to get the latest version of build-tools using the following sequence
btversion=`sdkmanager --list | tac | sed "/build-tools/q" | tac | sed -n 1p`
btversion=${btversion% *}
btversion=${btversion:2}
I am trying to do something similar to install platforms;android-%version%, except doing something like this lead me to a dead end:
sdkmanager --list | tac | sed "/platforms;android-[0-9]+/g"
The [0-9]+ filter is necessary as packages such as platforms;android-TiramisuPrivacySandbox show up in the list.
I would like to know what would be a better filter. For reference, this is how the output of sdkmanager --list sort of looks like
platforms;android-27 | 3 | Android SDK Platform 27
platforms;android-28 | 6 | Android SDK Platform 28
platforms;android-29 | 5 | Android SDK Platform 29
platforms;android-30 | 3 | Android SDK Platform 30
platforms;android-31 | 1 | Android SDK Platform 31
platforms;android-32 | 1 | Android SDK Platform 32
platforms;android-33 | 2 | Android SDK Platform 33
It would be like
sdkmanager --list | egrep -i 'platforms;android-[0-9]{2}' | tac | head -n 1 | sed 's/\(platforms;android-[0-9]\+\).*/\1/'
or
sdkmanager --list | egrep -i 'platforms;android-[0-9]{2}' | sed 's/\(platforms;android-[0-9]\+\).*/\1/' | tail -1

Cannot get Pulsar proxy HTTP and binary URLs

I am currently working on installing Pulsar inside of Minikube. The installation seems to be going okay, however at the end when I try to get the HTTP proxy URL and binary proxy URL... I get an error message that I am not specifying a valid service:
xyz-MBP:pulsar xyz$ kubectl get services -n pulsar | grep pulsar-mini-proxy
pulsar-mini-proxy LoadBalancer 10.107.193.52 <pending> 80:31241/TCP,6650:32025/TCP 8h
xyz-MBP:pulsar xyz$ minikube service pulsar-mini-proxy -n pulsar –-url
❌ Exiting due to MK_USAGE: You must specify a service name
Is there something I am doing wrong in the command I am using to display the services? Why doesn't the proxy show up as a service?
Here is what I did to get Pulsar installed into Minikube:
#!/bin/bash
# this script assumes that the pre-requisites have been
# installed, and that you just need to create a minikube
# cluster and then deploy pulsar to it
# startup a minikube kubernetes cluster
minikube start --memory=8192 --cpus=4 --kubernetes-version=v1.19.0
# point kubectl towards minikube
kubectl config use-context minikube
# install the pulsar helm chart
./pulsar-helm-chart/scripts/pulsar/prepare_helm_release.sh --create-namespace --namespace pulsar --release pulsar-mini
# install pulsar using the helm chart
helm install --set initialize=true --values pulsar-helm-chart/examples/values-minikube.yaml -n pulsar pulsar-mini apache/pulsar
# wait and then show what is going on
sleep 1m
kubectl get all
# need to wait or else the pods wont display
sleep 5m
# display the pods
kubectl get pods -n pulsar -o name
Just another update, it doesn't look like anything gets a URL assigned to it from the helm install:
xyz-MBP:pulsar xyz$ minikube service list
|-------------|----------------------------|--------------|-----|
| NAMESPACE | NAME | TARGET PORT | URL |
|-------------|----------------------------|--------------|-----|
| default | kubernetes | No node port |
| kube-system | kube-dns | No node port |
| pulsar | pulsar-mini-bookie | No node port |
| pulsar | pulsar-mini-broker | No node port |
| pulsar | pulsar-mini-grafana | server/3000 | |
| pulsar | pulsar-mini-prometheus | No node port |
| pulsar | pulsar-mini-proxy | http/80 | |
| | | pulsar/6650 | |
| pulsar | pulsar-mini-pulsar-manager | server/9527 | |
| pulsar | pulsar-mini-toolset | No node port |
| pulsar | pulsar-mini-zookeeper | No node port |
|-------------|----------------------------|--------------|-----|
I have a similar kind of setup and I installed the helm before installing the pulsar in the minikube. After I executed these two commands and got the urls.
$ kubectl -n pulsar get services
$ minikube service -n pulsar pulsar-mini-proxy

fastlane gym - specify derived_data_path but still creates DerivedData in XCode default location as well

Am using a fastlane setup on a CI server where I call 'gym' then 'scan'. Both commands are passed the derived_data_path: param to a custom path. What actually happens though is, as soon as gym starts, the standard ~/Library/Developer/XCode/DerivedData path is written to as well as the custom path I have passed to gym. This results in later attempts to clean up the artifacts from DerivedData using clear_derived_data only clearing one of the two DerivedData folders. How can I get xcodebuild/gym to not write to that default ~/Library/Developer/XCode/DerivedData path?
I do notice that the output of the gym command looks different than scan in that the xcodebuild commands for gym dont seem to include the -deriveddata param like I would expect. Here is the output from the console log for gym:
15:34:03 [15:34:03]: -----------------
15:34:03 [15:34:03]: --- Step: gym ---
15:34:03 [15:34:03]: -----------------
15:34:04 [15:34:04]: $ xcodebuild -list -project ./randomprojecthere.xcodeproj -configuration Enterprise
15:34:05 [15:34:05]: $ xcodebuild clean -showBuildSettings -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Enterprise
15:34:06
15:34:06 +----------------------+---------------------------------------------------------------------------+
15:34:06 | Summary for gym 2.17.0 |
15:34:06 +----------------------+---------------------------------------------------------------------------+
15:34:06 | scheme | randomprojecthere (Enterprise) |
15:34:06 | clean | true |
15:34:06 | configuration | Enterprise |
15:34:06 | export_method | enterprise |
15:34:06 | silent | true |
15:34:06 | output_directory | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85 |
15:34:06 | derived_data_path | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/De... |
15:34:06 | archive_path | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/Ar... |
15:34:06 | output_name | randomprojecthere |
15:34:06 | project | ./randomprojecthere.xcodeproj |
15:34:06 | destination | generic/platform=iOS |
15:34:06 | use_legacy_build_api | false |
15:34:06 | buildlog_path | ~/Library/Logs/gym |
15:34:06 | xcode_path | /Applications/Xcode.app |
15:34:06 +----------------------+---------------------------------------------------------------------------+
15:34:06
And here for scan:
15:34:52 [15:34:52]: $ xcodebuild -list -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:52 [15:34:52]: $ xcodebuild clean -showBuildSettings -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:53 [15:34:53]: $ xcodebuild -list -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:54 [15:34:54]: $ xcodebuild clean -showBuildSettings -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Debug
15:34:55
15:34:55 +------------------------+-------------------------------------------------------------------------+
15:34:55 | Summary for scan 2.17.0 |
15:34:55 +------------------------+-------------------------------------------------------------------------+
15:34:55 | device | iPad Air |
15:34:55 | scheme | randomprojecthere (Enterprise) |
15:34:55 | clean | false |
15:34:55 | configuration | Debug |
15:34:55 | output_types | junit |
15:34:55 | output_directory | /Users/userhere/.jenkins/workspace/UnifiediPad-Validation/test-... |
15:34:55 | derived_data_path | /Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/... |
15:34:55 | project | ./randomprojecthere.xcodeproj |
15:34:55 | skip_build | false |
15:34:55 | buildlog_path | ~/Library/Logs/scan |
15:34:55 | include_simulator_logs | false |
15:34:55 | open_report | false |
15:34:55 | skip_slack | false |
15:34:55 | slack_only_on_failure | false |
15:34:55 | use_clang_report_name | false |
15:34:55 | fail_build | true |
15:34:55 | xcode_path | /Applications/Xcode.app |
15:34:55 +------------------------+-------------------------------------------------------------------------+
15:34:55
15:34:55 [15:34:55]: $ set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme randomprojecthere\ \(Enterprise\) -project ./randomprojecthere.xcodeproj -configuration Debug -destination 'platform=iOS Simulator,id=3EC3DEA8-6E4C-49E1-91B1-A7E57F44AE94' -derivedDataPath '/Users/userhere/.jenkins/jobs/UnifiediPad-Validation/builds/85/DerivedData' build test | tee '/Users/userhere/Library/Logs/scan/randomprojecthere-randomprojecthere (Enterprise).log' | xcpretty
Again, both commands are passed the same custom path values for the derived_data_path: param

How can I specify a display?

When I run some programs over SSH, such as firefox &, I get an error
Error: no display specified
I would like to open many displays, still showing the stdout of each program.
Initial Question: How can I specify the display to get a many-displayed program?
Pablo Santa Cruz gives me the following code as a solution.
I do not understand it.
$ export DISPLAY=yourmachine.yourdomain.com:0.0
$ firefox &
What are yourmachine and yourdomain.com in the command?
The way that X works is the same as the way any network program works. You have a server of some description (in this case, the X display server) which runs on a specific machine, and you have X clients (like firefox) that try to connect to that server to get their information displayed.
Often (on "home" machines), the client and server run on the same box and there's only one server, but X is powerful enough that this doesn't need to happen. It was built with the server/client separation built in from the start.
This allows you to do such wondrous things such as log on to your box (in text mode) halfway around the planet, tell it that the display server is the box you're currently on and, voila, the windows suddenly start appearing locally.
In order for a client to interact with a user, it needs to know how to find the server. There are a number of ways to do this. Many clients allow the -display or --displayoption to specify it:
xeyes -display paxbox1.paxco.com:0.0
Many will use the DISPLAY environment variable if a display isn't specifically given. You can set this variable like any other:
DISPLAY=paxbox1.paxco.com:0.0; export DISPLAY # in .profile
export DISPLAY=paxbox1.paxco.com:0.0 # in your shell
DISPLAY=paxbox1.paxco.com:0.0 firefox & # for that command (shell permitting)
The first part of the DISPLAY variable is just the address of the display server machine. It follows the same rule as any other IP address; it can be a resolvable DNS name (including localhost) or a specific IP address (such as 192.168.10.55).
The second part is X-specific. It gives the X "display" (X server) number and screen number to use. The first (display number) generally refers to a group of devices containing one or more screens but with a single keyboard and mouse (i.e., one input stream). The screen number generally gives the specific screen within that group.
An example would be:
+----------------------------------------+
|paxbox1.paxco.com| |
+-----------------+ |
| |
| +----------+----+ +----------+----+ |
| |Display :0| | |Display :1| | |
| +----------+ | +----------+ | |
| | | | | |
| | +-----------+ | | | |
| | |Screen :0.0| | | | |
| | +-----------+ | | | |
| | +-----------+ | | | |
| | |Screen :0.1| | | | |
| | +-----------+ | | | |
| | +-----------+ | | +-----------+ | |
| | |Screen :0.2| | | |Screen :1.0| | |
| | +-----------+ | | +-----------+ | |
| | +-----------+ | | +-----------+ | |
| | |Screen :0.3| | | |Screen :1.1| | |
| | +-----------+ | | +-----------+ | |
| | +-----------+ | | +-----------+ | |
| | | Keyboard | | | | Keyboard | | |
| | +-----------+ | | +-----------+ | |
| | +-----------+ | | +-----------+ | |
| | | Mouse | | | | Mouse | | |
| | +-----------+ | | +-----------+ | |
| +---------------+ +---------------+ |
| |
+----------------------------------------+
Here you have a single machine (paxbox1.paxco.com) with two display servers. The first has four screens and the second has two. The possibilities are then:
DISPLAY=paxbox1.paxco.com:0.0
DISPLAY=paxbox1.paxco.com:0.1
DISPLAY=paxbox1.paxco.com:0.2
DISPLAY=paxbox1.paxco.com:0.3
DISPLAY=paxbox1.paxco.com:1.0
DISPLAY=paxbox1.paxco.com:1.1
depending on where you want your actual windows to appear and which input devices you want to use.
$ export DISPLAY=yourmachine.yourdomain.com:0.0
$ firefox &
When you are connecting to another machine over SSH, you can enable X-Forwarding in SSH, so that X windows are forwarded encrypted through the SSH tunnel back to your machine. You can enable X forwarding by appending -X to the ssh command line or setting ForwardX11 yes in your SSH config file.
To check if the X-Forwarding was set up successfully (the server might not allow it), just try if echo $DISPLAY outputs something like localhost:10.0.
login to your server via
ssh -X root#yourIP
edit /etc/ssh/sshd_config file, and add this line to it.
X11UseLocalhost no
Restart sshd. for CentOS (check your distribution)
/sbin/service sshd restart
check your DISPLAY
echo $DISPLAY
you should see this
yourIP:10.0
Enjoy
firefox
for more info
Try
export DISPLAY=localhost:0.0
Please do NOT try to set $DISPLAY manually when connecting over SSH.
If you connect via SSH -X and $DISPLAY stays empty, this usually means that no encrypted channel could be established.
Most likely you are missing the package xauth or xorg-x11-xauth. Try to install it on the remote machine using:
sudo apt-get install xauth
or
sudo apt-get install xorg-x11-xauth
After that end and restart your SSH connection. Don't forget to use SSH -X so that X Window output is forwarded to your local machine.
Now try echo $DISPLAYagain to see if $DISPLAY has been set automatically by the SSH demon. It should show you a line with an IP address and a port.
I ran into a similar issue, so maybe this answer will help someone.
The reason for the Error: no display specified error is that Firefox is being launched, but there is no X server (GUI) running on the remote host. You can use X11 forwarding to run Firefox on the remote host, but display it on your local host. On Mac OS X, you will need to download XQuartz in order to use X11 forwarding. Without it, you won't have a $DISPLAY variable set, so if you try and echo $DISPLAY, it will be blank.
Try installing the xorg-x11-xauth package.
I faced similar problem today. So, here's a simple solution:
While doing SSH to the machine, just add Ctrl - Y.
ssh user#ip_address -Y
After login, type firefox &.
And you are good to go.
Even i faced the same in CentOS 6.8.
yum reinstall xorg*
End your current session and open another session in tool like mobiXterm. Make sure session has X11 forwarding enabled in the tool.
I through vnc to understand the X11 more.
To specify the display to get a many-displayed program,
export DISPLAY=IP:DisplayNum.ScreenNum
For example,
vncserver :2
vncserver -list
echo '$DISPLAY'=$DISPLAY
export DISPLAY=:2 # export DISPLAY=IP:DisplayNum or export DISPLAY=:DisplayNum for localhost; So that can vnc connect and see the vnc desktop :2 if $DISPLAY is not :2.
echo '$DISPLAY'=$DISPLAY
I'm using xming server before typing firefox use the following command
export DISPLAY=0:0

Resources