Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-07-18 07:25:34 +0300
committerStan Hu <stanhu@gmail.com>2019-07-18 07:25:34 +0300
commit9631f7423b3b6595b8f4871348298edb67099463 (patch)
treee5701691ebd1f8ec97c480040ba55c0304775f83
parent734b2a67103bd318a164a4f765b1cde327c57137 (diff)
parentd84363ed1ba7e24e528cdac10938dc0133582346 (diff)
Merge branch 'ashmckenzie/ci-improvements' into 'master'
Improve .gitlab-ci.yml Closes #555 See merge request gitlab-org/gitlab-development-kit!727
-rw-r--r--.gitlab-ci.yml90
-rw-r--r--support/ci/functions47
-rwxr-xr-xsupport/ci/test_install11
-rwxr-xr-xsupport/ci/test_update15
4 files changed, 103 insertions, 60 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 057c4443d93..21e52a5e6eb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,8 +10,33 @@ variables:
DOCKER_DRIVER: overlay
TEST_IMAGE: registry.gitlab.com/gitlab-org/gitlab-development-kit:latest
+# Use eclint to check that the .editorconfig rulesets are being adhered to
+verify:
+ stage: build
+ image: registry.gitlab.com/gitlab-org/gitlab-build-images:node-10
+ script:
+ - npm config set unsafe-perm true # enable run npm as root
+ - make verify
+
+build:image:
+ image: docker:git
+ stage: build
+ script:
+ # taken from https://gitlab.com/gitlab-org/gitlab-qa/blob/master/.gitlab-ci.yml
+ - ./bin/docker load
+ - ./bin/docker build
+ - ./bin/docker store
+ - test -n "$CI_BUILD_TOKEN" || exit 0
+ - ./bin/docker publish
+ when: manual
+ cache:
+ key: "docker-build-cache"
+ paths:
+ - ./latest_image.tar
+
code_quality:
image: docker:stable
+ stage: test
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
@@ -30,6 +55,7 @@ code_quality:
container_scanning:
image: docker:stable
+ stage: test
allow_failure: true
before_script: []
cache: {}
@@ -56,80 +82,24 @@ container_scanning:
paths:
- gl-sast-container-report.json
-# Use eclint to check that the .editorconfig rulesets are being adhered to
-verify:
- stage: build
- image: registry.gitlab.com/gitlab-org/gitlab-build-images:node-10
- script:
- - npm config set unsafe-perm true # enable run npm as root
- - make verify
-
-build:image:
- image: docker:git
- stage: build
- script:
- # taken from https://gitlab.com/gitlab-org/gitlab-qa/blob/master/.gitlab-ci.yml
- - ./bin/docker load
- - ./bin/docker build
- - ./bin/docker store
- - test -n "$CI_BUILD_TOKEN" || exit 0
- - ./bin/docker publish
- when: manual
- cache:
- key: "docker-build-cache"
- paths:
- - ./latest_image.tar
-
test:install:
image: $TEST_IMAGE
stage: test
artifacts:
paths:
- - ./*.log
- - ./gitlab/log/*.log
+ - ./gitlab-development-kit/gitlab/log/*.log
expire_in: 2 days
when: always
script:
- - source /home/gdk/.bash_profile
- - gem install -N bundler:1.17.3
- - cd gem
- - gem build gitlab-development-kit.gemspec
- - gem install gitlab-development-kit-*.gem
- - cd /home/gdk
- - gdk init
- - cd gitlab-development-kit
- - git remote set-url origin $CI_REPOSITORY_URL
- - git fetch
- - git checkout $CI_COMMIT_SHA
- - netstat -lpt
- - IGNORE_INSTALL_WARNINGS=true gdk install
- - support/set-gitlab-upstream
- - killall node || true
- - gdk run &
- - sleep 30
- - curl -f --retry 60 --retry-delay 5 http://127.0.0.1:3000/
+ - support/ci/test_install
test:update:
image: $TEST_IMAGE
stage: test
artifacts:
paths:
- - ./*.log
- - ./gitlab/log/*.log
+ - ./gitlab-development-kit/gitlab/log/*.log
expire_in: 2 days
when: always
script:
- - source /home/gdk/.bash_profile
- - gem install -N bundler:1.17.3
- - gem install gitlab-development-kit
- - cd /home/gdk
- - gdk init
- - cd gitlab-development-kit
- - netstat -lpt
- - IGNORE_INSTALL_WARNINGS=true gdk install
- - support/set-gitlab-upstream
- - killall node || true
- - gdk run &
- - sleep 30
- - curl -f --retry 60 --retry-delay 5 http://127.0.0.1:3000/
- - IGNORE_INSTALL_WARNINGS=true gdk update
+ - support/ci/test_update
diff --git a/support/ci/functions b/support/ci/functions
new file mode 100644
index 00000000000..ed62d95474a
--- /dev/null
+++ b/support/ci/functions
@@ -0,0 +1,47 @@
+# vim: filetype=sh
+
+GDK_CHECKOUT_PATH="$(pwd)/gitlab-development-kit"
+
+init() {
+ source ${HOME}/.bash_profile
+ gem install -N bundler:1.17.3
+ cd gem
+ gem build gitlab-development-kit.gemspec
+ gem install gitlab-development-kit-*.gem
+ gdk init ${GDK_CHECKOUT_PATH}
+}
+
+checkout() {
+ cd ${GDK_CHECKOUT_PATH}
+ git remote set-url origin ${CI_REPOSITORY_URL}
+ git fetch
+ git checkout ${1}
+}
+
+install() {
+ cd ${GDK_CHECKOUT_PATH}
+ netstat -lpt
+ echo "> Installing GDK.."
+ IGNORE_INSTALL_WARNINGS=true gdk install shallow_clone=true
+ support/set-gitlab-upstream
+}
+
+update() {
+ cd ${GDK_CHECKOUT_PATH}
+ netstat -lpt
+ echo "> Updating GDK.."
+ IGNORE_INSTALL_WARNINGS=true gdk update
+ support/set-gitlab-upstream
+}
+
+run() {
+ cd ${GDK_CHECKOUT_PATH}
+ killall node || true
+ echo "> Starting up GDK.."
+ gdk run
+}
+
+test_url() {
+ echo "> Testing GDK.."
+ curl -f --retry 60 --retry-delay 5 http://127.0.0.1:3000/users/sign_in
+}
diff --git a/support/ci/test_install b/support/ci/test_install
new file mode 100755
index 00000000000..733d2411bba
--- /dev/null
+++ b/support/ci/test_install
@@ -0,0 +1,11 @@
+#!/bin/bash -e
+
+source support/ci/functions
+
+init
+checkout ${CI_COMMIT_SHA}
+install
+run &
+echo "> Waiting 45 secs to give GDK a change to boot up.."
+sleep 45
+test_url
diff --git a/support/ci/test_update b/support/ci/test_update
new file mode 100755
index 00000000000..508c590c028
--- /dev/null
+++ b/support/ci/test_update
@@ -0,0 +1,15 @@
+#!/bin/bash -e
+
+source support/ci/functions
+
+init
+checkout "master"
+install
+run &
+echo "> Waiting 45 secs to give GDK a change to boot up.."
+sleep 45
+checkout ${CI_COMMIT_SHA}
+update
+echo "> Waiting 60 secs to give GDK a change to boot up.."
+sleep 60
+test_url