Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webservice
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DevOps (Lecture FB VI)
webservice
Merge requests
!25
Pipeline
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Pipeline
s76867/webservice-devops:pipeline
into
main
Overview
1
Commits
13
Pipelines
1
Changes
2
Closed
Gideon Bensch
requested to merge
s76867/webservice-devops:pipeline
into
main
5 months ago
Overview
1
Commits
13
Pipelines
1
Changes
2
Expand
1
Merge request reports
Compare
main
main (base)
and
latest version
latest version
f2e195b8
13 commits,
5 months ago
2 files
+
46
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
.gitlab-ci.yml
+
44
−
6
Options
# mostly from https://github.com/lucendio/lecture-devops-code/blob/911cb6dab66674aa71789568494a27dc58108491/exercises/define-and-run-pipeline/.gitlab-ci.yml#L46:L67
# Run pipeline if pushed to "pipeline" branch
workflow
:
rules
:
-
if
:
>-
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
when
:
'
always'
-
when
:
'
never'
$CI_PIPELINE_SOURCE == "push"
&& ($CI_COMMIT_BRANCH == "pipeline")
when
:
always
# Otherwise
-
when
:
never
stages
:
-
test
-
build
-
run
test-job
:
stage
:
test
image
:
mirror.gcr.io/library/golang:1.21
script
:
-
echo "running tests"
-
go get -t ./...
-
go test -race -v ./...
build-job
:
stage
:
build
image
:
mirror.gcr.io/library/golang:1.21
before_script
:
-
mkdir -p ./artifacts
script
:
-
echo "installing dependencies..."
-
go get -t ./...
-
echo "building artifact..."
-
go build -o ./artifacts/artifact.bin ./*.go
artifacts
:
paths
:
-
./artifacts
expire_in
:
10 sec
job_trigger-pipeline
:
trigger
:
project
:
'
fb6-wp11-devops/webservice-build-and-publish'
run-job
:
stage
:
run
image
:
mirror.gcr.io/library/golang:1.21
script
:
-
echo "running locally..."
-
go run .
environment
:
production
\ No newline at end of file
Loading