Fix GitlabCI repository url and improve Android dockerfiles

This commit is contained in:
Gioacchino Mazzurco 2021-11-05 13:14:27 +01:00
parent a9fe1ba6de
commit 7ae314440f
No known key found for this signature in database
GPG Key ID: A1FBCA3872E87051
4 changed files with 25 additions and 6 deletions

View File

@ -13,7 +13,6 @@ workflow:
- if: $CI_COMMIT_BRANCH - if: $CI_COMMIT_BRANCH
variables: variables:
REPO_ARGS_CMD: '[ -n "$CI_MERGE_REQUEST_ID" ] && echo --build-arg REPO_URL=\"$CI_MERGE_REQUEST_SOURCE_PROJECT_URL\" --build-arg REPO_BRANCH=\"$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\" || echo --build-arg REPO_URL=\"$CI_REPOSITORY_URL\" --build-arg REPO_BRANCH=\"$CI_COMMIT_BRANCH\"'
UBUNTU_TESTING_IMAGE_TAG: "$CI_REGISTRY_IMAGE/gitlabci_outputs/ubuntu_testing:$CI_COMMIT_SHA" UBUNTU_TESTING_IMAGE_TAG: "$CI_REGISTRY_IMAGE/gitlabci_outputs/ubuntu_testing:$CI_COMMIT_SHA"
build-ubuntu-test-image: build-ubuntu-test-image:
@ -27,7 +26,7 @@ build-ubuntu-test-image:
- > - >
docker build docker build
-t $UBUNTU_TESTING_IMAGE_TAG -t $UBUNTU_TESTING_IMAGE_TAG
$($REPO_ARGS_CMD) $($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/gitlabCI.Dockerfile --file $CI_PROJECT_DIR/build_scripts/GitlabCI/gitlabCI.Dockerfile
Dockercontext Dockercontext
- docker push $UBUNTU_TESTING_IMAGE_TAG - docker push $UBUNTU_TESTING_IMAGE_TAG
@ -74,7 +73,8 @@ build-android-arm-apk:
script: script:
- mkdir Dockercontext - mkdir Dockercontext
- > - >
docker build -t retroshare:android_arm_latest $($REPO_ARGS_CMD) docker build -t retroshare:android_arm_latest
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile --file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile
Dockercontext Dockercontext
# see https://stackoverflow.com/a/59055906 # see https://stackoverflow.com/a/59055906
@ -92,7 +92,8 @@ build-android-arm64-apk:
script: script:
- mkdir Dockercontext - mkdir Dockercontext
- > - >
docker build -t retroshare:android_arm64_latest $($REPO_ARGS_CMD) docker build -t retroshare:android_arm64_latest
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--build-arg ANDROID_PLATFORM_VER=21 --build-arg ANDROID_PLATFORM_VER=21
--build-arg ANDROID_NDK_ARCH=arm64 --build-arg ANDROID_NDK_ARCH=arm64
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile --file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile

View File

@ -16,6 +16,11 @@
# docker login registry.gitlab.com # docker login registry.gitlab.com
# docker push ${CI_IMAGE_NAME} # docker push ${CI_IMAGE_NAME}
## To extract the generated APK easily you can run after the build complete
# docker cp \
# $(docker create --rm ${CI_IMAGE_NAME}):/retroshare-service-android-build/android-build/build/outputs/apk/debug/android-build-debug.apk \
# /tmp/RetroShare_Android_Service.apk
FROM ubuntu:20.04 FROM ubuntu:20.04
@ -85,6 +90,7 @@ RUN qmake ../RetroShare/jsonapi-generator/src/ \
RUN mkdir /retroshare-service-android-build RUN mkdir /retroshare-service-android-build
WORKDIR /retroshare-service-android-build WORKDIR /retroshare-service-android-build
ARG RS_SERVICE_QMAKE_EXTRA_OPTS
RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/qmake ../RetroShare \ RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/qmake ../RetroShare \
-spec android-clang \ -spec android-clang \
CONFIG+=retroshare_service CONFIG+=rs_jsonapi \ CONFIG+=retroshare_service CONFIG+=rs_jsonapi \
@ -93,7 +99,8 @@ RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/qmake ../RetroShare \
NATIVE_LIBS_TOOLCHAIN_PATH=$NATIVE_LIBS_TOOLCHAIN_PATH \ NATIVE_LIBS_TOOLCHAIN_PATH=$NATIVE_LIBS_TOOLCHAIN_PATH \
CONFIG+=no_retroshare_gui CONFIG+=no_rs_service_webui_terminal_password \ CONFIG+=no_retroshare_gui CONFIG+=no_rs_service_webui_terminal_password \
CONFIG+=no_rs_service_terminal_login \ CONFIG+=no_rs_service_terminal_login \
CONFIG+=no_rs_sam3 CONFIG+=no_rs_sam3_libsam3 CONFIG+=no_rs_sam3 CONFIG+=no_rs_sam3_libsam3 \
$RS_SERVICE_QMAKE_EXTRA_OPTS
RUN make -j$(nproc) RUN make -j$(nproc)
RUN make install INSTALL_ROOT=/retroshare-service-android-build/android-build/ RUN make install INSTALL_ROOT=/retroshare-service-android-build/android-build/
RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/androiddeployqt \ RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/androiddeployqt \

View File

@ -25,6 +25,7 @@ WORKDIR /retroshare-service-android-build
# ARG declared before FROM get wiped after it, so we need declaring it again # ARG declared before FROM get wiped after it, so we need declaring it again
ARG ANDROID_NDK_ARCH=arm ARG ANDROID_NDK_ARCH=arm
ARG RS_SERVICE_QMAKE_EXTRA_OPTS
RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/qmake ../RetroShare \ RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/qmake ../RetroShare \
-spec android-clang \ -spec android-clang \
CONFIG+=retroshare_service CONFIG+=rs_jsonapi \ CONFIG+=retroshare_service CONFIG+=rs_jsonapi \
@ -33,7 +34,8 @@ RUN $($PREPARE_TOOLCHAIN get_qt_dir | head -n 1)/bin/qmake ../RetroShare \
NATIVE_LIBS_TOOLCHAIN_PATH=$NATIVE_LIBS_TOOLCHAIN_PATH \ NATIVE_LIBS_TOOLCHAIN_PATH=$NATIVE_LIBS_TOOLCHAIN_PATH \
CONFIG+=no_retroshare_gui CONFIG+=no_rs_service_webui_terminal_password \ CONFIG+=no_retroshare_gui CONFIG+=no_rs_service_webui_terminal_password \
CONFIG+=no_rs_service_terminal_login \ CONFIG+=no_rs_service_terminal_login \
CONFIG+=no_rs_sam3 CONFIG+=no_rs_sam3_libsam3 CONFIG+=no_rs_sam3 CONFIG+=no_rs_sam3_libsam3 \
$RS_SERVICE_QMAKE_EXTRA_OPTS
RUN make -j$(nproc) RUN make -j$(nproc)
RUN make install INSTALL_ROOT=/retroshare-service-android-build/android-build/ RUN make install INSTALL_ROOT=/retroshare-service-android-build/android-build/

View File

@ -0,0 +1,9 @@
#!/bin/sh
[ -n "$CI_MERGE_REQUEST_ID" ] &&
echo \
--build-arg REPO_URL="$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" \
--build-arg REPO_BRANCH="$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ||
echo \
--build-arg REPO_URL="$CI_REPOSITORY_URL" \
--build-arg REPO_BRANCH="$CI_COMMIT_BRANCH"