Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error during execution CI/CD in gitlab for a project

I need to configure CI/CD service of gitlab. So, I created a file .gitlab-ci.yml

image: openjdk:8-jdk

variables:
  ANDROID_COMPILE_SDK: "26"
  ANDROID_BUILD_TOOLS: "26.0.2"

before_script:
  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/tools_r${ANDROID_SDK_TOOLS}-linux.zip
  - unzip android-sdk.zip
  - export ANDROID_HOME=$PWD/
  - echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter android-${ANDROID_COMPILE_SDK}
  - echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter platform-tools
  - echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter build-tools-${ANDROID_BUILD_TOOLS}
  - echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
  - echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
  - echo y | $ANDROID_HOME/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
  - export PATH=$PATH:$ANDROID_HOME
  - chmod +x ./gradlew

stages:
  - build

build:
  stage: build
  script:
    - ./gradlew assembleDebug
  artifacts:
    paths:
    - app/build/outputs/

I need only build an artifact in cloud without testing. So, after commit at master, cd pipeline start execution, and fail. It failed all time on downloading an sdk:

.....
Preparing to unpack .../libc6-i386_2.24-11+deb9u1_amd64.deb ...
Unpacking libc6-i386 (2.24-11+deb9u1) ...
Selecting previously unselected package lib32z1.
Preparing to unpack .../lib32z1_1%3a1.2.8.dfsg-5_amd64.deb ...
Unpacking lib32z1 (1:1.2.8.dfsg-5) ...
Selecting previously unselected package lib32gcc1.
Preparing to unpack .../lib32gcc1_1%3a6.3.0-18_amd64.deb ...
Unpacking lib32gcc1 (1:6.3.0-18) ...
Selecting previously unselected package lib32stdc++6.
Preparing to unpack .../lib32stdc++6_6.3.0-18_amd64.deb ...
Unpacking lib32stdc++6 (6.3.0-18) ...
Setting up libc6-i386 (2.24-11+deb9u1) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Setting up lib32z1 (1:1.2.8.dfsg-5) ...
Setting up lib32gcc1 (1:6.3.0-18) ...
Setting up lib32stdc++6 (6.3.0-18) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
$ wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/tools_r${ANDROID_SDK_TOOLS}-linux.zip
ERROR: Job failed: exit code 1
like image 984
Sergey Grishin Avatar asked Nov 19 '22 00:11

Sergey Grishin


1 Answers

You have no variable ANDROID_SDK_TOOLS as used in the wget, you only have:

  • ANDROID_BUILD_TOOLS
  • ANDROID_COMPILE_SDK
like image 76
Stefan van Gastel Avatar answered Dec 15 '22 16:12

Stefan van Gastel