Logo

dev-resources.site

for different kinds of informations.

Running my first Gitlab CI/CD pipeline

Published at
4/18/2021
Categories
gitlab
mkdocs
docker
devops
Author
cosckoya
Categories
4 categories in total
gitlab
open
mkdocs
open
docker
open
devops
open
Author
8 person written this
cosckoya
open
Running my first Gitlab CI/CD pipeline

I was testing some Gitlab functionalities on my last jobs, but I've never played it by myself so, I decided to migrate my personal wiki/toolbox into Gitlab pages and see how it goes.

Why Gitlab? Because I am feeling more comfortable with it. Github is a very nice SCM but I wanted to start working with Gitlab and I though that this could be a very nice opportunity to do so.

So, I migrated my repository from Github to Gitlab, just pushing all the files to an empty Gitlab repository project. That's all.

Also I created a ".gitlab-ci.yaml" file with a few steps to control the deployment:

image: python:3.8-buster

before_script:
  - pip install -r requirements.txt

test:
  stage: test
  script:
  - mkdocs build --strict --verbose --site-dir test
  artifacts:
    paths:
    - test
  except:
  - master

pages:
  stage: deploy
  script:
  - mkdocs build --strict --verbose --site-dir public
  artifacts:
    paths:
    - public
  only:
  - master
Enter fullscreen mode Exit fullscreen mode

Leaving this file in the repository root path, now the project looks like this:

CMD> tree -a -L 1                       
.
ā”œā”€ā”€ docs
ā”œā”€ā”€ .git
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ .gitlab-ci.yml
ā”œā”€ā”€ mkdocs.yml
ā”œā”€ā”€ README.md
ā””ā”€ā”€ requirements.txt

2 directories, 5 files
Enter fullscreen mode Exit fullscreen mode

When I just committed my changes into the repository, everything starts to run and the CI finally just deployed my project into Gitlab Pages. Here is the result: Cosckoya Gitlab pages.

Amazing.

I really want to test some more Gitlab CI/CD (Terraform, Docker, Helm) and integrations (Hangouts, Slack) with this new toy of mine.

Enjoy!

Featured ones: