CI / CD Gitlab管道

时间:2019-12-13 13:10:01

标签: android bash docker build apk

我正在构建一个脚本来自动化android应用程序的构建。我正在Gitlab上使用它,我们正在使用docker维护图像。

现在,我正在脚本文件中使用以下代码。

#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(readlink -f "$SCRIPT_DIR/..")"

cd "$PROJECT_ROOT"



#Start Build Process
echo "\n\n\nStarting"
echo "\n\n\nCleaning...\n"
./gradlew clean --stacktrace

echo "\n\n\ncleanBuildCache...\n"
./gradlew cleanBuildCache --stacktrace

echo "\n\n\n build...\n"
./gradlew build --stacktrace

echo "\n\n\n assembleDebug...\n"
./gradlew assembleDebug --stacktrace

#Install APK on device / emulator
#echo "installDebug...\n"
#./gradlew installDebug

echo "\n\n\n Done Installing\n"


#Copy APK to output folder
cp "$PROJECT_DIR"app/build/outputs/apk/debug/app-debug.apk $OUTPUT_DIR
echo "\n\n\n Copying APK to outputs Done\n"

运行此bash文件时,

我遇到以下错误,

Caused by: java.io.FileNotFoundException: /project/.gradle/5.4.1/fileHashes/fileHashes.lock (Permission denied)
    at org.gradle.cache.internal.filelock.LockFileAccess.<init>(LockFileAccess.java:33)
    at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.<init>(DefaultFileLockManager.java:156)
    at org.gradle.cache.internal.DefaultFileLockManager.lock(DefaultFileLockManager.java:107)
    ... 91 more

有什么问题,请有人可以给我建议。

谢谢

0 个答案:

没有答案