August 20, 2019
Using tools to facilitate and maintain a project is usually a primary issue.
If you have some experience with linux it is quite easy to set up a CI pipeline, in fact the easiest setup I’ve found is to use a gitlab-runner process hooked up to a gitlab server, so whenever you push to a defined branch the server will notify the runner and the procedure will run.
This setup relies on a linux server (here we use Ubuntu 18.04 ami) and a Gitlab.com account, but you can use any gitlab version or linux OS.
ssh-keygen, we’ll use this to enable authorization and pull from the gitlab server(do not add a password).
id_rsa.pubkey into gitlab.com
Install gitlab-runner on our Ubuntu server:
curl -L https://packages.gitlab.com/install/repositories/ runner/gitlab-runner/script.deb.sh | sudo bash.
sudo apt-get install gitlab-runner.
tokenfrom the gitlab server, you can use the default for every other parameter, but use
shellas the executor.
gitlab-runner runand woilà!!
<leader> + d(If you haven’t aliased it tmux
<leader>key is CTRL-b; in case you want to reattach it
Then you’ll need a
.gitlab-ci.yml configuration file in the root of your project, here’s my example:
stages: - deploy master: stage: deploy environment: name: production only: - master script: - cd ~/www/cloned-repo - git checkout master - git pull - npm run build
With this config every time you push on master the commands specified in the script portion will run sequentially.
Here we’re building a node app, and since the distribution folder that’s created is already served by our server we’re done.
And now that you’ve got your CI pipeline setup, the deploy stage is set up, procrastination is over, you just need to develop…
Francesco Calo developing on linux in La Spezia.
Just a programming journey.