Skip to content

Unable to integrate with Jenkins #116

Description

@nadishan

I run this image using Jenkins. But gradlew is failed with this error message.

The SDK directory is not writable (/opt/android)

Jenkinsefile

pipeline {
  agent {
    docker {
      image 'reactnativecommunity/react-native-android'
    }

  }
  stages {
    stage('Test') {
      steps {
        sh 'npm install'
      }
    }

    stage('Build') {
      steps {
        sh 'cd android && chmod +x gradlew && ./gradlew assembleRelease'
      }
    }

    stage('PROD') {
      parallel {
        stage('PROD') {
          steps {
            echo 'prod'
          }
        }

        stage('DEV') {
          steps {
            echo 'dev'
          }
        }

      }
    }

  }
  environment {
    npm_config_cache = 'npm-cache'
  }
}

Activity

  1. gengjiawen commented on Jan 28, 2021

    @gengjiawen
    Member

    Not sure jenkins version you are using. Works well on our jenkins server.

  2. robcee commented on Aug 31, 2021

    @robcee

    I'm having issues with our jenkins installation as well. We're on Jenkins 2.289 and when using the docker agent, we're running inside it as the jenkins user on the node. This runs into a bunch of permissions and home directory issues inside the container during yarn / npm installs.

    To get around this, we've tried running the container as root by passing -u 0:0. This works fine, but the outputs on our workspace are all owned by the root user (uid 0) and not readable by any of the subsequent steps (e.g., archiving artifacts).

    If you @gengjiawen have any insights, I'd love to hear them. Thanks!

  3. HugoGresse commented on Nov 26, 2021

    @HugoGresse

    the issue on my side was using another buildToolsVersion from the one referenced in this repo.
    For android 30, the build tools available is 30.0.3 which is different from the one react native used (30.0.2). This cause gradle to download it, which is something not possible.

  4. amdrade commented on Jul 31, 2024

    @amdrade

    Can I pass it by ARG parameter?
    ANDROID_TOOLS_VERSION

    docker build --build-arg ANDROID_TOOLS_VERSION=31.0.0 --build-arg ANDROID_BUILD_VERSION=31 . -f Dockerfile -t docker-rn

    even so it only installs version 33.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions