Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DevOpsWS2024
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alina Schmidt
DevOpsWS2024
Commits
ab36ba1c
Commit
ab36ba1c
authored
4 months ago
by
Alina Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
pipeline test
parent
c513cc11
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#73453
failed
4 months ago
Stage: build
Stage: test
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DefineAndRunPipeline/webservice/.gitlab-ci.yml
+38
-13
38 additions, 13 deletions
DefineAndRunPipeline/webservice/.gitlab-ci.yml
README.md
+5
-0
5 additions, 0 deletions
README.md
with
43 additions
and
13 deletions
DefineAndRunPipeline/webservice/.gitlab-ci.yml
+
38
−
13
View file @
ab36ba1c
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-job
2
:
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'"
This diff is collapsed.
Click to expand it.
README.md
+
5
−
0
View file @
ab36ba1c
# 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment