Skip to content
Snippets Groups Projects
Commit ab36ba1c authored by Alina Schmidt's avatar Alina Schmidt
Browse files

pipeline test

parent c513cc11
No related branches found
No related tags found
No related merge requests found
Pipeline #73453 failed
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- if: >-
$CI_PIPELINE_SOURCE == "push"
&& ($CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "release")
when: always
- when: never
variables:
version: 0.0.$CI_PIPELINE_IID
GO_BIN_DIR: bin
stages:
- build
- test
- deploy
.image:
image: golang:1.21.6-alpine
build-job:
stage: build
extends:
- .image
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
- go get -t ./...
- go build -o ./artifact.bin ./*.go
test-job1:
stage: test
script:
- echo "This job tests something"
artifacts:
paths:
- ./artifacts
test-job2:
test-job:
stage: test
extends:
- .image
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
- go get -t ./...
- go test -race -v ./...
deploy-prod:
deploy-job:
stage: deploy
needs: [build-job]
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
environment: production
\ No newline at end of file
- "echo 'deploy'"
# DevOpsWS2024
# Sources
## Exercise: Define and run a Pipeline
Aaron Goldenthal (2024), https://aarongoldenthal.com/posts/gitlab-ci-pipeline-for-go-projects/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment