This commit is contained in:
Stefan Schüller 2020-07-12 14:18:47 +02:00
parent f8d210fd80
commit 2298727788

View File

@ -1,3 +1,5 @@
image: vratislav/gitlab-ci-fastlane-android
stages: stages:
- environment - environment
- build - build
@ -8,35 +10,44 @@ stages:
- production - production
- stop - stop
.updateContainerJob: before_script:
image: docker:stable - export GRADLE_USER_HOME=$(pwd)/.gradle
stage: environment - chmod +x ./gradlew
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG || true
- docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
updateContainer: cache:
extends: .updateContainerJob key: ${CI_PROJECT_ID}
only: paths:
changes: - .gradle/
- Dockerfile #
#.updateContainerJob:
ensureContainer: # image: docker:stable
extends: .updateContainerJob # stage: environment
allow_failure: true # services:
before_script: # - docker:dind
- "mkdir -p ~/.docker && echo '{\"experimental\": \"enabled\"}' > ~/.docker/config.json" # script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY # - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# Skip update container `script` if the container already exists # - docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG || true
# via https://gitlab.com/gitlab-org/gitlab-ce/issues/26866#note_97609397 -> https://stackoverflow.com/a/52077071/796832 # - docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- docker manifest inspect $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG > /dev/null && exit || true # - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
#
#updateContainer:
# extends: .updateContainerJob
# only:
# changes:
# - Dockerfile
#
#ensureContainer:
# extends: .updateContainerJob
# allow_failure: true
# before_script:
# - "mkdir -p ~/.docker && echo '{\"experimental\": \"enabled\"}' > ~/.docker/config.json"
# - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# # Skip update container `script` if the container already exists
# # via https://gitlab.com/gitlab-org/gitlab-ce/issues/26866#note_97609397 -> https://stackoverflow.com/a/52077071/796832
# - docker manifest inspect $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG > /dev/null && exit || true
.build_job: .build_job:
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG # image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
stage: build stage: build
before_script: before_script:
# We store this binary file in a variable as hex with this command, `xxd -p thorium-android-app.jks` # We store this binary file in a variable as hex with this command, `xxd -p thorium-android-app.jks`
@ -74,7 +85,7 @@ buildRelease:
name: production name: production
testDebug: testDebug:
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG # image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
stage: test stage: test
dependencies: dependencies:
- buildDebug - buildDebug
@ -82,7 +93,7 @@ testDebug:
- bundle exec fastlane test - bundle exec fastlane test
publishInternal: publishInternal:
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG # image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
stage: internal stage: internal
dependencies: dependencies:
- buildRelease - buildRelease
@ -95,7 +106,7 @@ publishInternal:
- bundle exec fastlane internal - bundle exec fastlane internal
.promote_job: .promote_job:
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG # image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
when: manual when: manual
dependencies: [] dependencies: []
before_script: before_script: