gitlab-ci-runner

Deploy every build to a server using Gitlab CI

吃可爱长大的小学妹 提交于 2019-11-29 20:12:04
I've set up my own Gitlab server with one project and a Gitlab runner configured for it. I'm new to continuous integration server and therefore don't know how to accomplish the following. Every time I commit to the master branch of my project I would like to deploy the repository to another server and run two shell-commands there ( npm install and forever restartall ) How would I do this? Do I need a runner on the machine which the project is deployed to as well? michael You could use gitlab-ci and gitlab-runner [runners.ssh] to deploy to single or mutiple servers. the flow: (git_project with

Gitlabs artifact of one project used in further projects

自闭症网瘾萝莉.ら 提交于 2019-11-29 18:35:01
问题 Question What is the best way to carry artifacts (jar, class, war) among projects when using docker containers in CI phase. Let me explain my issue in details, please don't stop the reading... =) Gitlabs project1 unit tests etc... package Gitlabs project2 unit test etc... build (failing) here I need one artifact (jar) generated in project1 Current scenario / comments I'm using dockers so in each .gitlab-ci.yml I'll have independent containers All is working fine in project1 If I use "shell"

Trigger jobs in gitlab-ci on merge request

空扰寡人 提交于 2019-11-29 16:47:52
问题 It's posible run a job from gitlab-ci only on merge request? Now, we have a big monolitic project with heavy tests, but we only want to run the test before merging to the branch master. 回答1: This is now possible. This has been introduced in GitLab 11.6. 回答2: Well, it's not built in currently however it's not impossible to do it yourself. Gitlab allows to trigger a job. It also supports webhooks on merge requests. However webhooks don't support variable in URIs and triggers can't read request

Gitlab - failed to authenticate remote server for CI and CD build

人盡茶涼 提交于 2019-11-29 12:49:05
I am getting " Enter passphrase for /dev/fd/63 " error when my " .gitlab-ci.yml " tries to remote to my Ubuntu server for executing SSH commands. I have created a new variable called " STAGING_PRIVATE_KEY " and the value is the private key that I personally use to SSH to the server, but providing the same key to ".gitlab-ci.yml" fails to authenticate. Below is my yml file: deploy_staging: stage: deploy before_script: - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' - mkdir -p ~/.ssh - eval $(ssh-agent -s) - '[[ -f /.dockerenv ]] && echo -e "Host *\n

Docker-in-Docker with Gitlab Shared runner for building and pushing docker images to registry

随声附和 提交于 2019-11-29 09:17:58
问题 Been trying to set-up Gitlab CI which can build a docker image, and came across that DinD was enabled initially only for separate runners and Blog Post suggest it would be enabled soon for shared runners, Running DinD requires enabling privileged mode in runners, which is set as a flag while registering runner, but couldn't find an equivalent mechanism for Shared Runners 回答1: The shared runners are now capable of building Docker images. Here is the job that you can use: stages: - build - test

Multiline YAML string for GitLab CI (.gitlab-ci.yml)

时光总嘲笑我的痴心妄想 提交于 2019-11-29 05:23:55
I'm trying to write a gitlab-ci.yml file which uses a multi-line string for the command. However, it seems like it is not being parsed. I've tried both the - | and - > with identical results. stages: - mystage Build: stage: mystage script: - | echo -e " echo 'hi'; echo 'bye'; " When it tries to run, it only shows echo -e ' as the script to run, and not the whole multiline string. This causes issues for me. What would be the correct syntax to write something like this? TL;DR; You want to use a multi-line YAML scalar (for readability) that is loaded as a single line string that can be issued as

GitLab CI runner can't connect to unix:///var/run/docker.sock in kubernetes

落花浮王杯 提交于 2019-11-29 05:05:27
问题 GitLab's running in kubernetes cluster. Runner can't build docker image with build artifacts. I've already tried several approaches to fix this, but no luck. Here are some configs snippets: .gitlab-ci.yml image: docker:latest services: - docker:dind variables: DOCKER_DRIVER: overlay stages: - build - package - deploy maven-build: image: maven:3-jdk-8 stage: build script: "mvn package -B --settings settings.xml" artifacts: paths: - target/*.jar docker-build: stage: package script: - docker

gitlab 8.2.1, How to use cache in .gitlab-ci.yml

◇◆丶佛笑我妖孽 提交于 2019-11-28 22:48:40
I'm trying to use 'cache' in .gitlab-ci.yml ( http://doc.gitlab.com/ce/ci/yaml/README.html#cache ). My gitlab version is 8.2.1 and my Runner is: $ docker exec -it gitlab-runner gitlab-runner -v gitlab-runner version 0.7.2 (998cf5d) So according to the doc, everything is up to date, but I'm unable to use the cache ;-(. All my files are always deleted. Am I doing something wrong? A cache archive is created, but not passed to the next jobs. Here is my .gitlab-ci.yml $ cat .gitlab-ci.yml stages: - createcache - testcache createcache: type: createcache cache: untracked: true paths: - doc/ script: -

How to enable maven artifact caching for gitlab ci runner?

安稳与你 提交于 2019-11-28 16:39:41
We use gitlab ci with shared runners to do our continuous integration. For each build, the runner downloads tons of maven artifacts. Is there a way to configure gitlab ci to cache those artifacts so we can speed up the building process by preventing downloading the same artifact over and over again? Gitlab CI allows you to define certain paths, which contain data that should be cached between builds, on a per job or build basis (see here for more details). In combination with khmarbaise's recommendation, this can be used to cache dependencies between multiple builds. An example that caches all

Deploy every build to a server using Gitlab CI

跟風遠走 提交于 2019-11-28 16:01:37
问题 I've set up my own Gitlab server with one project and a Gitlab runner configured for it. I'm new to continuous integration server and therefore don't know how to accomplish the following. Every time I commit to the master branch of my project I would like to deploy the repository to another server and run two shell-commands there ( npm install and forever restartall ) How would I do this? Do I need a runner on the machine which the project is deployed to as well? 回答1: You could use gitlab-ci