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
!27
Tut01 - test new pipeline variante
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Tut01 - test new pipeline variante
s92604/devops-webservice:tut01
into
main
Overview
0
Commits
35
Pipelines
2
Changes
2
Closed
Yana Kernerman
requested to merge
s92604/devops-webservice:tut01
into
main
4 months ago
Overview
0
Commits
35
Pipelines
2
Changes
2
Expand
Merge request reports
Compare
main
main (base)
and
latest version
latest version
fac45bab
35 commits,
4 months ago
2 files
+
82
−
7
Side-by-side
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
+
57
−
7
Options
workflow
:
workflow
:
rules
:
rules
:
-
if
:
>-
-
if
:
$CI_PIPELINE_SOURCE == "merge_request_event"
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
when
:
always
when
:
'
always'
-
if
:
$CI_PIPELINE_SOURCE == "push" || $CI_COMMIT_BRANCH == "main"
-
when
:
'
never'
when
:
always
-
when
:
never
stages
:
-
test
-
build
-
publish
job_trigger-pipeline
:
job_test_the_code
:
trigger
:
stage
:
test
project
:
'
fb6-wp11-devops/webservice-build-and-publish'
image
:
registry.hub.docker.com/library/golang:1.21
script
:
-
go get -t ./...
-
go test -race -v ./...
rules
:
-
when
:
always
job_build_artifact
:
stage
:
build
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /main/
when
:
always
image
:
registry.hub.docker.com/library/golang:1.21
script
:
-
go get -t ./...
-
go build -o ./artifact.bin ./*.go
artifacts
:
paths
:
-
./artifact.bin
expire_in
:
1 week
job_publish_artifact
:
stage
:
publish
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~ /main/
when
:
always
image
:
curlimages/curl:latest
tags
:
-
docker-privileged
dependencies
:
-
job_build_artifact
script
:
-
echo "Publishing artifact..."
-
ls -al
-
pwd
-
echo "${CI_JOB_TOKEN}"
-
echo " ${CI_API_V4_URL}"
-
echo "${CI_PROJECT_ID}"
-
echo "${CI_COMMIT_REF_NAME}"
-
echo "${version}"
-
curl --version
-
|
curl \
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--upload-file ./artifact.bin \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/1.0.0/webservice"
Loading