diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fcef21d0..6d43e6aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,11 +13,9 @@ test: - bundle install --path /cache - bundle exec rake db:create RAILS_ENV=test - bundle exec rake test & bundle exec rspec & bundle exec rubocop - only: - refs: - - branches + except: variables: - - $GITLAB_TEST + - $CD_TEST_IGNORE build: stage: build @@ -34,7 +32,11 @@ build: - ./scripts/image_build.sh $CI_PROJECT_PATH $CI_COMMIT_REF_NAME $CI_COMMIT_SHA only: variables: - - $GITLAB_BUILD + - $CD_DOCKER_USERNAME + - $CD_DOCKER_PASSWORD + except: + variables: + - $CD_BUILD_IGNORE deploy: stage: deploy @@ -53,4 +55,9 @@ deploy: refs: - branches variables: - - $GITLAB_DEPLOY + - $CD_DOCKER_USERNAME + - $CD_DOCKER_PASSWORD + - $CD_DEPLOY_SCRIPT + except: + variables: + - $CD_DEPLOY_IGNORE diff --git a/.travis.yml b/.travis.yml index ac538212..e34890bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,22 @@ language: ruby rvm: - 2.5.1 -script: - - bundle install && bundle exec rubocop && bundle exec rspec +jobs: + include: + - stage: test + name: rubocop + script: bundle exec rubocop + if: env(CD_TEST_IGNORE) IS NOT present + + - stage: test + name: rspec + script: bundle exec rspec + if: env(CD_TEST_IGNORE) IS NOT present + + - stage: build + name: build docker image + script: bash scripts/image_build.sh $TRAVIS_REPO_SLUG $TRAVIS_BRANCH $TRAVIS_COMMIT + if: !env(TRAVIS_PULL_REQUEST) AND env(CD_BUILD_IGNORE) IS NOT present AND env(CD_DOCKER_USERNAME) IS present AND env(CD_DOCKER_PASSWORD) IS present notifications: email: false diff --git a/scripts/image_build.sh b/scripts/image_build.sh index 5c6b5221..0bf3295a 100755 --- a/scripts/image_build.sh +++ b/scripts/image_build.sh @@ -20,8 +20,6 @@ # as part of the development process. # -echo "v1.0.3" - display_usage() { echo "This script should be used as part of a CI strategy." echo -e "Usage:\n build_image.sh [ARGUMENTS]" diff --git a/scripts/image_deploy.sh b/scripts/image_deploy.sh index 253004c8..768c49b4 100755 --- a/scripts/image_deploy.sh +++ b/scripts/image_deploy.sh @@ -21,8 +21,6 @@ # or reviewing work as part of development process. # -echo "v1.0.3" - display_usage() { echo "This script should be used as part of a CI strategy." echo -e "Usage:\n build_image.sh [ARGUMENTS]"