fix availability of INFURA_TOKEN for Android build

The env variable `INFURA_TOKEN` is used at build time of JS bundle, not
the final APK file. We never passed the `secretsFile` to the
derivation for JS bundle so it never saw the `INFURA_TOKEN`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-10-05 14:53:20 +02:00
parent 966f6de31a
commit c4cac2cef7
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
8 changed files with 24 additions and 8 deletions

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.4'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'linux' }

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.4'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'linux' }

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.4'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'macos-xcode-11.5' }

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.4'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label params.AGENT_LABEL }

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.4'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'macos' }

View File

@ -1,4 +1,4 @@
library 'status-react-jenkins@v1.2.4'
library 'status-react-jenkins@v1.2.5'
pipeline {
agent { label 'linux' }

View File

@ -4,6 +4,9 @@
{ stdenv, lib, deps, pkgs }:
# Path to the file containing secret environment variables
{ secretsFile ? "" }:
stdenv.mkDerivation {
name = "status-react-build-jsbundle-android";
src =
@ -36,8 +39,18 @@ stdenv.mkDerivation {
};
};
buildInputs = with pkgs; [ clojure nodejs bash git openjdk];
phases = [
"unpackPhase" "secretsPhase" "patchPhase"
"configurePhase" "buildPhase" "installPhase"
];
# For optional INFURA_TOKEN variable
secretsPhase = if (secretsFile != "") then ''
source "${secretsFile}"
'' else ''
echo "No secrets provided!"
'';
phases = [ "unpackPhase" "patchPhase" "configurePhase" "buildPhase" "installPhase" ];
# Patching shadow-cljs.edn so it uses the local maven repo of dependencies provided by Nix
patchPhase =
let anchor = ''{:source-paths ["src" "test/cljs"]'';

View File

@ -19,6 +19,9 @@ let
toLower optionalString stringLength assertMsg
getConfig makeLibraryPath assertEnvVarSet elem;
# Pass secretsFile for INFURA_TOKEN to jsbundle build
builtJsBundle = jsbundle { inherit secretsFile; };
buildType = getConfig "build-type" "release";
buildNumber = getConfig "build-number" 9999;
gradleOpts = getConfig "android.gradle-opts" null;
@ -98,7 +101,7 @@ in stdenv.mkDerivation rec {
cp -bf ./${envFileName} ./.env
# Copy index.js and app/ input files
cp -ra --no-preserve=ownership ${jsbundle}/* ./
cp -ra --no-preserve=ownership ${builtJsBundle}/* ./
# Copy android/ directory
mkdir -p ./android/build