Google CloudBuild doesn't detect Licence

Aperta
#321 1 commento 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
docker, google-cloud
Ambito
ci-cd, cloud, devops

Direzione di ricerca

Inizia con ci/before_script.sh e ci/build.sh, quindi confronta il passaggio diretto di Cloud Build con la configurazione Docker-in-Docker funzionante nell’issue. Riproduci la configurazione della licenza usando il YAML cloudbuild fornito e ispeziona l’output di licensing di Unity. Il lavoro è completato quando il runner diretto di Cloud Build rileva la licenza decodificata e completa la build senza tentare l’attivazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Bug description

Context

I'm trying to setup the CI pipeline in Google CloudBuild.

Steps
  • I've followed carefully all the steps porting the gitlab pipeline example over.

  • I've generated and activated the license successfully. The generation was done in a CloudBuild runner and the activation manually in the unity website.

  • I've encoded to base64 the licence and added it as a secret environment variable. Then decoded it before saving it to disk.

Findings

The before_script.sh is running fine and writing to disk the licence at: /root/.local/share/unity3d/Unity/Unity_lic.ulf

I've also inspected the licence by cat /root/.local/share/unity3d/Unity/Unity_lic.ulf and it matches with the one i've downloaded.

The Problem

The problem i'm having is that when the build.sh is running it seems that doesn't detect the license file located in /root/.local/share/unity3d/Unity/Unity_lic.ulf and so it tries to generate a new license to activate.

Here is the output I'm getting:

docker.io/unityci/editor:2021.3.6f1-webgl-1.0.1
+ mkdir -p /root/.cache/unity3d
+ mkdir -p /root/.local/share/unity3d/Unity/
+ set +x
Writing '$UNITY_LICENSE' to license file /root/.local/share/unity3d/Unity/Unity_lic.ulf
+ echo 'Building for WebGL'
+ export BUILD_PATH=/workspace/Builds/WebGL/
+ BUILD_PATH=/workspace/Builds/WebGL/
+ mkdir -p /workspace/Builds/WebGL/
Building for WebGL
+ cat /root/.local/share/unity3d/Unity/Unity_lic.ulf
[REDACTED LICENCE OUTPUT]

Branch:                  2021.3/staging
Build type:              Release
Batch mode:              YES
System name:             Linux
Distro version:          #1 SMP Debian 5.10.127-1 (2022-06-30)
Kernel version:          5.10.0-16-cloud-amd64
Architecture:            x86_64
Available memory:        3930 MB
[LicensingClient] Channel doesn't exist: "LicenseClient-root"
[Licensing::Module] Successfully launched the LicensingClient (PId: 59)
[SignatureVerifier] Application signature verification not supported on this platform.
[LicensingClient] Handshaking with LicensingClient (version: 1.9.0+249add7)
[Licensing::Module] Successfully connected to LicensingClient on channel: "LicenseClient-root" (connect: 1.37s, validation: 0.20s, handshake: 0.00s)
[Licensing::Module] Connected to LicensingClient (PId: 59, launch time: 0.00, total connection time: 1.57s)
Entitlement-based licensing initiated
[Licensing::Module] Error: Access token is unavailable
[LicensingClient] Licenses updated successfully
[UnityConnectServicesConfig] config is NOT valid, switching to default
Cancelling DisplayDialog: Failed to activate/update license Missing or bad username or password. Please try again using valid credentials or contact [email protected]
This should not be called in batch mode.

cloud build:

steps:
  - name: unityci/editor:2021.3.6f1-webgl-1.0.1
    secretEnv: ['UNITY_LICENCE']
    entrypoint: "bash"
    args:
      - "-c"
      - |
        chmod +x ./ci/before_script.sh ./ci/build.sh && ./ci/before_script.sh && ./ci/build.sh
Ugly workaround

If i run the job by using "docker in docker" it seems to work correctly, for example, given the following configuration:

steps:
  - name: gcr.io/cloud-builders/docker
    secretEnv: ['UNITY_LICENCE']
    entrypoint: 'bash'
    args:
      - -c
      - |
         docker run --ipc=host \
            -e BUILD_TARGET="$$BUILD_TARGET" \
            -e BUILD_NAME=$$BUILD_NAME \
            -e UNITY_DIR=$$UNITY_DIR \
            -e VERSION_NUMBER_VAR=$$VERSION_NUMBER_VAR \
            -e VERSION_BUILD_VAR=$$VERSION_NUMBER_VAR \
            -e UNITY_LICENCE="$$UNITY_LICENCE" \
            -w /project/ \
            -v /workspace:/project/ \
            unityci/editor:2021.3.6f1-webgl-1.0.1 \
            /bin/bash -c "chmod +x /project/ci/before_script.sh /project/ci/build.sh && /project/ci/before_script.sh && /project/ci/build.sh"
    env:
      - 'BUILD_TARGET=WebGL'
      - 'BUILD_NAME=ShoppingMall'
      - 'UNITY_DIR=/project'
      - 'VERSION_NUMBER_VAR=$SHORT_SHA'
      - 'VERSION_BUILD_VAR=$REVISION_ID'

Steps to reproduce

Simply try to run the following job in cloudbuild:

steps:
  - name: unityci/editor:2021.3.6f1-webgl-1.0.1
    env:
      - 'UNITY_LICENCE=LICENCE_BASE64_HERE'
    entrypoint: "bash"
    args:
      - "-c"
      - |
        chmod +x ./ci/before_script.sh ./ci/build.sh && ./ci/before_script.sh && ./ci/build.sh

alter the before_script.sh to decode the variable, for example:

echo -n $UNITY_LICENCE | base64 -d | tr -d '\r' > ${unity_license_destination}

Expected behavior

The cloudbuild runner picks up the license when running the build.sh script

Additional details

Lingua principale
MDX
Stelle
247
Fork
133
Merge medio
1h 28m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di game-ci/documentation

Tutte le issue di game-ci/documentation

Issue simili

Altre issue su DevOps

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.