Skip to content

Commit

Permalink
Pass JAVA_VERSION and NODE_VERSION as build args to android builder i…
Browse files Browse the repository at this point in the history
…mages
  • Loading branch information
yousif-bugsnag committed Jan 18, 2024
1 parent c9732e0 commit d9b83f9
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 27 deletions.
5 changes: 3 additions & 2 deletions .buildkite/basic/react-native-android-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ steps:
build: react-native-android-builder
image-repository: 855461928731.dkr.ecr.us-west-1.amazonaws.com/js
cache-from: react-native-android-builder:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-${BRANCH_NAME}
args:
- JAVA_VERSION=17
- NODE_VERSION=18
- docker-compose#v4.12.0:
push: react-native-android-builder:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-${BRANCH_NAME}
retry:
Expand All @@ -29,7 +32,6 @@ steps:
- "android-builder-image"
timeout_in_minutes: 60
env:
JAVA_VERSION: "17"
REACT_NATIVE_VERSION: "rn0.73"
RN_NEW_ARCH: "false"
ARTEFACT_NAME: "rn0.73-old-arch"
Expand All @@ -50,7 +52,6 @@ steps:
- "android-builder-image"
timeout_in_minutes: 60
env:
JAVA_VERSION: "17"
REACT_NATIVE_VERSION: "rn0.73"
RN_NEW_ARCH: "true"
ARTEFACT_NAME: "rn0.73-new-arch"
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/full/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:
- label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: FULL REACT NATIVE (ANDROID) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:"
depends_on:
- "publish-js"
- "android-builder-image"
- "android-builder-base"
commands:
- buildkite-agent pipeline upload .buildkite/full/react-native-android-pipeline.full.yml

Expand Down
43 changes: 32 additions & 11 deletions .buildkite/full/react-native-android-pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,34 @@ steps:

- group: "React Native (Android) Tests"
steps:
#
# Android builder
#
- label: ":docker: Build legacy RN Android Builder image (Java 11, Node 16)"
key: "android-builder-image-legacy"
timeout_in_minutes: 30
plugins:
- docker-compose#v4.12.0:
build: react-native-android-builder
image-repository: 855461928731.dkr.ecr.us-west-1.amazonaws.com/js
cache-from: react-native-android-builder:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-${BRANCH_NAME}-jdk11-node16
args:
- JAVA_VERSION=11
- NODE_VERSION=16
- docker-compose#v4.12.0:
push: react-native-android-builder:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-${BRANCH_NAME}-jdk11-node16
retry:
automatic:
- exit_status: "*"
limit: 1

#
# Test fixtures
#
- label: ":android: Build RN 0.60 apk"
key: "rn-0-60-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.60"
Expand All @@ -27,7 +48,7 @@ steps:
- label: ":android: Build RN 0.66 apk"
key: "rn-0-66-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.66"
Expand All @@ -45,7 +66,7 @@ steps:
- label: ":android: Build RN 0.67 apk"
key: "rn-0-67-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.67"
Expand All @@ -63,7 +84,7 @@ steps:
- label: ":android: Build RN 0.68 Hermes apk"
key: "rn-0-68-hermes-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.68-hermes"
Expand All @@ -81,7 +102,7 @@ steps:
- label: ":android: Build RN 0.69 apk"
key: "rn-0-69-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.69"
Expand All @@ -99,7 +120,7 @@ steps:
- label: ":android: Build RN 0.71 (Old Arch) apk"
key: "rn-0-71-old-arch-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.71"
Expand All @@ -119,7 +140,7 @@ steps:
- label: ":android: Build RN 0.71 (New Arch) apk"
key: "rn-0-71-new-arch-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.71"
Expand All @@ -139,7 +160,7 @@ steps:
- label: ":android: Build react-navigation 0.60 apk"
key: "react-navigation-0-60-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.60"
Expand All @@ -159,7 +180,7 @@ steps:
- label: ":android: Build react-navigation 0.69 apk"
key: "react-navigation-0-69-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.69"
Expand All @@ -179,7 +200,7 @@ steps:
- label: ":android: Build react-native-navigation 0.60 apk"
key: "react-native-navigation-0-60-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.60"
Expand All @@ -199,7 +220,7 @@ steps:
- label: ":android: Build react-native-navigation 0.66 apk"
key: "react-native-navigation-0-66-apk"
depends_on:
- "android-builder-image"
- "android-builder-image-legacy"
timeout_in_minutes: 60
env:
REACT_NATIVE_VERSION: "rn0.66"
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/full/react-native-cli-pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ steps:
build: react-native-cli-android-builder
image-repository: 855461928731.dkr.ecr.us-west-1.amazonaws.com/js
cache-from: react-native-cli-android-builder:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-${BRANCH_NAME}
args:
- JAVA_VERSION=11
- docker-compose#v4.12.0:
push: react-native-cli-android-builder:855461928731.dkr.ecr.us-west-1.amazonaws.com/js:ci-${BRANCH_NAME}
retry:
Expand Down
22 changes: 12 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,18 @@ services:
- REG_BASIC_CREDENTIAL
- REG_NPM_EMAIL
- MAVEN_REPO_URL
- JAVA_VERSION
- NODE_VERSION
environment:
DEBUG:
BRANCH_NAME:
BUILDKITE:
REGISTRY_URL:
REACT_NATIVE_VERSION:
RN_NEW_ARCH:
NOTIFIER_VERSION:
ARTEFACT_NAME:
JS_SOURCE_DIR:
JAVA_VERSION: "${JAVA_VERSION:-11}"
- DEBUG
- BRANCH_NAME
- BUILDKITE
- REGISTRY_URL
- REACT_NATIVE_VERSION
- RN_NEW_ARCH
- NOTIFIER_VERSION
- ARTEFACT_NAME
- JS_SOURCE_DIR
networks:
default:
aliases:
Expand Down Expand Up @@ -170,6 +171,7 @@ services:
- REGISTRY_URL
- REG_BASIC_CREDENTIAL
- REG_NPM_EMAIL
- JAVA_VERSION
environment:
- VERBOSE
- DEBUG
Expand Down
1 change: 0 additions & 1 deletion dockerfiles/Dockerfile.android-builder-base
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM openjdk:11-jdk-bullseye as java-11

FROM openjdk:17-jdk-bullseye
COPY --from=java-11 /usr/local/openjdk-11 /usr/local/openjdk-11
ENV JAVA_HOME=/usr/local/openjdk-11

# OS setup
RUN apt-get update && apt-get install -y gradle jq git-core build-essential openssl libssl-dev
Expand Down
9 changes: 7 additions & 2 deletions dockerfiles/Dockerfile.react-native-android-builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
FROM 855461928731.dkr.ecr.us-west-1.amazonaws.com/js:android-builder-base

RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
# Java version
ARG JAVA_VERSION
ENV JAVA_HOME=/usr/local/openjdk-${JAVA_VERSION}

ARG NODE_VERSION
RUN curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
RUN apt-get install -y nodejs rsync

RUN npm i -g run-func
Expand Down Expand Up @@ -29,4 +34,4 @@ COPY lerna.json .
COPY scripts/common.js scripts/react-native-helper.js scripts/

# Do a full build by running the container
CMD JAVA_HOME=/usr/local/openjdk-${JAVA_VERSION} run-func scripts/react-native-helper.js buildAndroid "/app/test/react-native/features/fixtures" "/app/features/fixtures"
CMD run-func scripts/react-native-helper.js buildAndroid "/app/test/react-native/features/fixtures" "/app/features/fixtures"
4 changes: 4 additions & 0 deletions dockerfiles/Dockerfile.react-native-cli-android-builder
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
FROM 855461928731.dkr.ecr.us-west-1.amazonaws.com/js:android-builder-base

# Java version
ARG JAVA_VERSION
ENV JAVA_HOME=/usr/local/openjdk-${JAVA_VERSION}

RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt-get update && apt-get install -y nodejs rsync expect \
# Dependencies for MazeRunner
Expand Down

0 comments on commit d9b83f9

Please sign in to comment.