#StackBounty: #android #react-native #docker #jenkins #arm64 Android SDK on Docker for ARM64 (Raspberry Pi 4) for building APK

Bounty: 50

I am trying to create an ARM64 Docker image which is able to build an apk file of my React Native app.

Background:

For exercise purposes I built a Kubernetes cluster wiht 5 Raspberry Pi 4 boards. Everything is working fine, Jenkins is running on it and the backend part (Java Microservice, Maven) can be built, deployed and run on it.

Now I am trying to create a Pipeline for the Android App part, which I build in React Native, Gradle. I’m just learning how everything fits together and am stuck with building the apk file on Jenkins. Locally building it (on Linux) is working fine but I’m not able to create a Docker container for the aarch64 architecture with the necessary Android SDK stuff installed to build it with Jenkins. Here is what I have by now (tell me, if I have to provide more information!):

Dockerfile:

FROM openjdk:8-alpine3.9

ENV ANDROID_SDK_ROOT /opt/android-sdk-linux

RUN apk add --no-cache curl wget bash unzip 
    && apk add --no-cache --update nodejs npm 
    && npm install -g react-native-cli

RUN cd /opt 
    && wget -q https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip -O android-commandline-tools.zip 
    && mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools 
    && unzip -q android-commandline-tools.zip -d ${ANDROID_SDK_ROOT}/cmdline-tools 
    && rm android-commandline-tools.zip

ENV PATH ${PATH}:${ANDROID_SDK_ROOT}/platform-tools:${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin

RUN yes | sdkmanager --licenses

RUN touch /root/.android/repositories.cfg

# This part fails!
# RUN yes | sdkmanager "emulator" "platform-tools"

RUN yes | sdkmanager --update --channel=3
RUN yes | sdkmanager 
    "platforms;android-29" 
    "build-tools;29.0.3" 
    "build-tools;29.0.2" 
    "build-tools;29.0.1" 
    "build-tools;29.0.0"

Jenkinsfile:

pipeline {
    agent {
        kubernetes {
            defaultContainer 'app-build'
            yamlFile 'kubernetes-pod.yaml'
        }
    }
    stages {
        stage ('print env vars') {
            steps {
                sh 'printenv'
                sh 'echo "JAVA-VERSION: "'
                sh 'java -version'
                sh 'echo "NODE-VERSION:"'
                sh 'node --version'
                sh 'echo "NPM version:" '
                sh 'npm --version'
                sh 'echo "REACT-NATIVE-VERSION:"'
                sh 'react-native --version'
            }
        }
       stage ('Gradle Build') {
           steps {
               sh ('react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res')
               dir ('android') {
                   // this step fails (error message below)
                   gradlew('assembleRelease', '--scan')
               }
           }
       }

       /* ... more steps ... */
    }
}

def gradlew(String... args) {
    sh "./gradlew ${args.join(' ')} -s"
}

The error message I get on Jenkins is the following:

Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :react-native-reanimated
Warning: Dependant package with key emulator not found!

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jenkins/agent/workspace/nches_CHEF-8-frontend-deployment/node_modules/react-native-reanimated/android/build.gradle' line: 89

* What went wrong:
A problem occurred configuring project ':react-native-reanimated'.
> Failed to install the following SDK components:
      build-tools;29.0.2 Android SDK Build-Tools 29.0.2
  Install the missing components using the SDK manager in Android Studio.

kubernetes-pod.yaml

apiVersion: v1
kind: Pod
metadata:
  labels:
    label: jenkins-agent
    job: build-services
  namespace: build-services
spec:
  containers:
    - name: jnlp
      image: franzbuholzer/jenkins-jnlp-arm64:4.6
      tty: true
    - name: maven
      image: maven:3.6.3-jdk-11
      tty: true
      command: ["cat"]
      volumeMounts:
        - name: repository
          mountPath: /root/.m2/repository
    - name: docker
      image: docker:19.03.13
      command: ["cat"]
      tty: true
      volumeMounts:
        - name: docker-sock
          mountPath: /var/run/docker.sock
  volumes:
    - name: repository
      persistentVolumeClaim:
        claimName: repository
    - name: docker-sock
      hostPath:
        path: /var/run/docker.sock

I would be very happy if someone could help me solving this problem, that so I can attack the next obstacles, which I guess would be copying the generated apk into another Docker image and deploy it on the cluster to make it downloadable…


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!

#StackBounty: #disk-usage #jenkins after disk space freed, jenkins nodes doesn't come back online

Bounty: 150

I looked at https://unix.stackexchange.com/search?q=jenkins & Jenkins support https://issues.jenkins.io

I didn’t find out there how to solve that.

initial state

Nodes & main server had disk space issues, and no pipeline were triggered anymore.

After space issue has been solved nodes are still offline ignoring the new status.

how can I refresh those nodes to online state?

Architecture :

  • host connections uses java / git & ssh depending on with step/pipeline is running
  • pipelines usually uses git to get last groovy & script files ; & also run the jenkins groovy file on nodes
  • steps are calling ssh on either bash or powershell access when needed to access nodes & run scripts.

Done :

  • cleaned /var/lib on main jenkins server

    find . -name "xxxx" -atime +365 -exec rm {} ;

  • cleaned application drives on each nodes

    $limit = (Get-Date).AddDays(-30)
    $path = "xxxxxxx"
    Get-ChildItem -Path $path -Recurse -Force -filter XXXXX | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
  • restarted jenkins service on main jenkins server

    sudo systemctl restart jenkins

Current Status :

  • Those nodes remains offline (and still display as error the same space amount warning, this is like it doesn’t read/detect the new available space)
    Disk space is too low. Only 0.000GB left on F:jenkins2.
    
    Agent is connected.

on machines for example :

DriveType    : 3
ProviderName :
FreeSpace    : 255938342912
Size         : 449998483456
VolumeName   : Disk2

so jenkins ignore issue about disk space is solved & keeps nods offline
how to make them online again ?


Get this bounty!!!