Skip to content

Instantly share code, notes, and snippets.

@wickedev
Created May 21, 2020 23:18
Show Gist options
  • Save wickedev/43178d63566f7696314484840eae7e20 to your computer and use it in GitHub Desktop.
Save wickedev/43178d63566f7696314484840eae7e20 to your computer and use it in GitHub Desktop.
.gitlab-ci.yml
image: java:8-jdk
stages:
- test
- build
- deploy
variables:
DOCKER_DRIVER: overlay2
cache:
key: global
paths:
- .gradle
- build
test:
stage: test
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
- cp $GRADLE_PROPERTIES gradle.properties
script:
- ./gradlew -PdevMode --parallel --profile --build-cache check
artifacts:
paths:
- build/reports/profile/*
expire_in: 1 day
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- cp $DOCKER_CONFIG_JSON /kaniko/.docker/config.json
- >-
/kaniko/executor --context $CI_PROJECT_DIR \
--dockerfile $CI_PROJECT_DIR/Dockerfile \
--destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
only:
- kaniko
jib:
stage: build
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
- cp $GRADLE_PROPERTIES gradle.properties
script:
- ./gradlew -PdevMode --parallel --profile --build-cache jib
only:
- master
artifacts:
paths:
- build/reports/profile/*
expire_in: 1 day
deploy:
stage: deploy
image: alpine/helm:latest
script:
- echo $CI_COMMIT_SHORT_SHA
- >-
helm --kubeconfig $DEPLOY_KUBECONFIG \
-n igosa \
upgrade -i igosa ./deploy \
--set image.version=$CI_COMMIT_SHORT_SHA
only:
- master
after_script:
- echo "End CI"
stages:
- build
- deploy
cache:
key: global
paths:
- .yarn-cache
- node_modules
build:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- cp $DOCKER_CONFIG_JSON /kaniko/.docker/config.json
- >-
/kaniko/executor --context $CI_PROJECT_DIR \
--dockerfile $CI_PROJECT_DIR/Dockerfile \
--destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
only:
- master
deploy:
stage: deploy
image:
name: alpine/helm:3.1.2
entrypoint: [""]
script:
- >-
helm --kubeconfig $DEPLOY_KUBECONFIG \
upgrade -i admin ./deploy \
-n igosa \
-f deploy/values.yaml \
--set image.repository=$CI_REGISTRY_IMAGE \
--set image.version=$CI_COMMIT_SHORT_SHA
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment