Closed luckyraul closed 4 years ago
The Google Cloud integration can be added to the hub
section of integrations
in CI. However, that will automatically authenticate with GCR and so the key will require access to GCR. For the application in the link you have included, it may be easier to add the integration to a runCI job as part of an Assembly Line and use the environment variable provided (<NAME>_INTEGRATION_JSON_KEY
) with the value to write the key to a file in your preferred location for your other scripts.
Can you provide sample yaml ?
The integration resource may be added to a runCI step as part of an Assembly Line (documentation describing how to add the Assembly Line YML here). And the the variable, as described on http://docs.shippable.com/platform/integration/gcloudKey/ will be available in the CI script. The Assembly Line YML may be in the same file as the CI YML or a different file. They're both listed together here, but I've added comments to note which section needs to be in each file, should you prefer separate files.
## Assembly Line YML
resources:
- name: myGoogleCloudIntegrationResource
type: integration
integration: Google # The name of the integration as listed on the project integrations page
jobs:
# This is the job that is already enabled for CI.
# The name is as listed on the subscription dashboard, usually <repositoryName>_runCI.
# The input in steps is the name of the integration resource in resources.
- name: myRepo_runCI
type: runCI
steps:
- IN: myGoogleCloudIntegrationResource
## CI YML
# This is not a complete YML for your project, but shows writing the key to a file
# and exporting that location as GOOGLE_APPLICATION_CREDENTIALS. The
# name of the file may be changed to better suit your project and the language,
# the language and env sections replaced with those required by your project, and
# the rest of your script added to the ci section.
language: java
jdk:
- openjdk11
env:
global:
- ANDROID_HOME=/opt/android-sdk
- ANDROID_SDK=/opt/android-sdk/tools/bin
build:
ci:
- echo $MYGOOGLECLOUDINTEGRATIONRESOURCE_INTEGRATION_JSON_KEY > myKeyFile
- export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/myKeyFile
- echo "This represents the rest of my build script"
thanks
How to do in shippable.yml scenario with Google Cloud Service Account.
Can I use integrations? How to use them in ci section ?
https://firebase.google.com/docs/app-distribution/android/distribute-gradle?authuser=0#authenticate_using_a_service_account