DEV Community

Cover image for Running my first Gitlab CI/CD pipeline
cosckoya
cosckoya

Posted on

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!

Top comments (0)