I am trying to debug my yaml file for android deployment. The step with its default values: android/decode-keystore
I get the following error: bash: .: filename argument required
.: usage: . filename [arguments]
When running the command shown in the documentation locally I still get the same error. Command being:
#!/bin/bash
PARAM_BASE64_KEYSTORE=$(eval echo "\$$PARAM_BASE64_KEYSTORE")
echo "$PARAM_BASE64_KEYSTORE" | base64 -di | tee keystore
"${PARAM_KEYSTORE_LOCATION}" > /dev/null
environment:
PARAM_BASE64_KEYSTORE: << parameters.base64-keystore >> (Default being "BASE64_KEYSTORE")
PARAM_KEYSTORE_LOCATION: << parameters.keystore-location >> (Default being .)
From doing some debugging looks like the . for << parameters.keystore-location >> is the problem.
jerdog
August 2, 2023, 6:27pm
2
I have a couple questions that should hopefully help us get to an answer:
When you say that “the command shown in the documentation locally” still gives you the error, where are you running that command? On your computer?
Where and how are you setting up << parameters.keystore-location >>
? A config.yml
file should help us understand more what might be happening
I am running on a ubuntu machine with android studio from the terminal.
I am running circleci locally with the follow command:
circleci config process .circleci/local_config.yml > process.yml
circleci local execute -c process.yml deploy-to-play-store-1 -e $GIT_EMAIL="*****@gmail.com" -e BASE64_KEYSTORE=$BASE64_KEYSTORE -e RELEASE_KEYSTORE=$RELEASE_KEYSTORE -e RELEASE_STORE_PASSWORD=$RELEASE_STORE_PASSWORD -e RELEASE_KEY_PASSWORD=$RELEASE_KEY_PASSWORD -e RELEASE_KEY_ALIAS=$RELEASE_KEY_ALIAS -e DOCKER_USERNAME=$DOCKER_USERNAME -e DOCKER_PASSWORD=$DOCKER_PASSWORD -e DRIVER_GOOGLE_SERVICES_B64=$DRIVER_GOOGLE_SERVICES_B64
But here is the full local_config.yml:
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
# For a detailed guide to building and testing on Android, read the docs:
# https://circleci.com/docs/2.0/language-android/ for more details.
version: 2.1
# Orbs are reusable packages of CircleCI configuration that you may share across projects, enabling you to create encapsulated, parameterized commands, jobs, and executors that can be used across multiple projects.
# See: https://circleci.com/docs/2.0/orb-intro/
orbs:
android: circleci/android@2.3.0
commands:
setup_repo:
description: checkout repo and android dependencies
steps:
- checkout
# - run:
# name: Setup subtree for test data
# command: |
# mkdir -p ~/.ssh
# echo 'github.com ssh-rsa *** >> ~/.ssh/known_hosts
# git config --global user.email "$GIT_EMAIL"
# git config --global user.name "$GIT_EMAIL"
# git fetch driver_app_data
# git subtree add --prefix=app_data https://github.com/***/*** --squash
- android/restore-gradle-cache
- run:
name: Download Dependencies
command: |
sudo chmod +x ./gradlew
./gradlew androidDependencies
# Setup files for build.
- run:
name: Setup variables for build
command: |
echo "$GOOGLE_SERVICES_KEY" > "app/google-services.json"
run_tests:
description: run non-instrumentation tests for flavour specified
parameters:
flavour:
type: string
default: "Driver"
steps:
# The next step will run the unit tests
- run:
name: Run non-instrumentation unit tests
command: |
./gradlew test<< parameters.flavour >>DebugUnitTest --continue
- store_artifacts:
path: app/build/reports
destination: reports
- store_test_results:
path: app/build/test-results
run_ui_tests:
description: start firebase emulator and run ui tests for flavour specified
parameters:
flavour:
type: string
default: "Driver"
steps:
# Download and cache dependencies
- restore_cache:
keys:
- emulator-cache-v1-
# Install Firebase tools needed for firebase emulator
- run:
name: Install firebase tools
command: |
curl -sL firebase.tools | bash
# Then start the emulator and run the Instrumentation tests!
- android/start-emulator-and-run-tests:
post-emulator-launch-assemble-command: ./gradlew assemble<< parameters.flavour >>DebugAndroidTest
test-command: ./gradlew connected<< parameters.flavour >>DebugAndroidTest
system-image: system-images;android-25;google_apis;x86
pull-data: true
pull-data-path: /storage/emulated/0/Android/data/
pull-data-target: ~/app-data
pre-emulator-wait-steps:
# Start firebase emulator in the background while waiting to start testing
- run:
name: Start firebase emulator and while avd starts
command: |
firebase emulators:start --import=driver_app_data/export_directory
background: true
post-run-tests-steps:
# Save cache for firebase tools
- save_cache:
paths:
- ~/.cache/firebase/emulators/
key: emulator-cache-v1-{{ epoch }}
# store test reports
- store_artifacts:
path: app/build/reports/androidTests/connected
destination: reports
# store screenshots for failed ui tests
- store_artifacts:
path: ~/app-data
destination: data
# Then publish the artifacts of the Firebase emulator logs!
- run:
name: save firebase emulator logs
command: |
mkdir -p tmp/firebase_logs
cp *.log tmp/firebase_logs
- store_artifacts:
path: tmp/firebase_logs
destination: logs
# Then publish the results of the Instrumentation tests!
- store_test_results:
path: app/build/outputs/androidTest-results/connected
# Define a job to be invoked later in a workflow.
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
jobs:
# Below is the definition of your job to build and test your app, you can rename and customize it as you want.
build-and-test:
# Parameters used for determining
parameters:
flavour:
type: string
default: "Driver"
# These next lines define the Android machine image executor.
# See: https://circleci.com/docs/2.0/executor-types/
docker:
- image: cimg/android:2023.07-browsers
auth:
username: ${DOCKER_USERNAME}
password: ${DOCKER_PASSWORD}
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
# Checkout the code and its submodule as the first step.
- setup_repo
- run_tests:
flavour: << parameters.flavour >>
- run_ui_tests:
flavour: << parameters.flavour >>
deploy-to-play-store:
# Parameters used for determining
parameters:
flavour:
type: string
default: "Driver"
# These next lines define the Android machine image executor.
# See: https://circleci.com/docs/2.0/executor-types/
docker:
- image: cimg/android:2023.07-browsers
auth:
username: ${DOCKER_USERNAME}
password: ${DOCKER_PASSWORD}
# Add steps to the job
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
steps:
- checkout
- run:
name: Setup variables for build
command: |
echo "$DRIVER_GOOGLE_SERVICES_B64" | base64 --decode > "app/google-services.json"
- android/restore-gradle-cache
- run:
name: Setup gradle
command: |
sudo chmod +x gradlew
- android/decode-keystore:
keystore-location: "./app/keystore.jks"
- android/create-keystore-properties:
release-keystore: "keystore.jks"
- run: ./gradlew androidDependencies
- android/save-gradle-cache
- android/create-google-play-key
- android/fastlane-deploy:
lane-name: deploy<< parameters.flavour >>
# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
workflows:
version: 2
build-release-driver:
jobs:
- build-and-test:
flavour: "Driver"
filters:
branches:
ignore:
- main_admin
- deploy-to-play-store:
flavour: "Driver"
filters:
branches:
only:
- main_driver
requires:
- build-and-test
build-release-admin:
jobs:
- build-and-test:
flavour: "Admin"
filters:
branches:
ignore:
- main_driver
- deploy-to-play-store:
flavour: "Admin"
filters:
branches:
only:
- main_driver
requires:
- build-and-test
jerdog
August 3, 2023, 10:06pm
4
Thanks for the info!
So first off, was this working at any point, and was something changed?
Secondly, is it possible to copy the full section before the error, in a code block, so it’s easy to review? The android/decode-keystore
command in the CircleCI Android orb wants a string location, and defaults to .
, and where it is failing from your info is when that’s called, and you’ve set the location as
keystore-location: "./app/keystore.jks"
It would be good to see the full error and the lines before it it to see what we can figure out.