Sunday, April 10, 2022

gitlab pipelines

Create the below file, it will automatically generate a simple pipeline for your repo.

in root or sub folders
.gitlab-ci.yml
------------
stages:
  - build
  - test

build the car:
  stage: build
  script:
    - mkdir build
    - cd build
    - touch car.txt
    - echo "chasis" >> car.txt
    - echo "engine" >> car.txt
    - echo "wheels" >> car.txt
  artifacts:
    paths:
     - build/

test the car:
  stage: test
  script:
    - ls
    - test -f build/car.txt
    - cd build
    - cat car.txt
    - grep "chasis" car.txt

You may encounter a problem where your GitLab CI pipeline is not running.

Make sure that:

- You have named your file .gitlab-ci.yml (and not gitlab-ci.yml or .gitlab-ci.yaml)

- the pipeline file is in the root of the project and not inside a directory

- Auto DevOps is NOT enabled

No comments:

Post a Comment