Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Devops 2024
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
Deniz Cankurtaran
Devops 2024
Merge requests
!3
Feature02
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Feature02
feature02
into
release
Overview
0
Commits
2
Pipelines
1
Changes
1
Merged
Deniz Cankurtaran
requested to merge
feature02
into
release
4 months ago
Overview
0
Commits
2
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
release
release (base)
and
latest version
latest version
f357623f
2 commits,
4 months ago
1 file
+
10
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
define_and_run_a_pipeline/.gitlab-ci.yml
+
10
−
9
Options
@@ -2,10 +2,16 @@ 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
GO_BIN_PATH
:
./${GO_BIN_DIR}/${CI_PROJECT_NAME}
stages
:
-
test
@@ -14,9 +20,6 @@ stages:
.image
:
image
:
golang:1.21.6-alpine
variables
:
GOPATH
:
$CI_PROJECT_DIR/.go
GO_BIN_DIR
:
bin
test application
:
stage
:
"
test"
@@ -24,7 +27,6 @@ test application:
-
.image
script
:
-
go mod download
-
go get -t ./...
build application
:
stage
:
"
build"
@@ -32,17 +34,16 @@ build application:
-
.image
script
:
-
go mod download
-
go build $GO_BUILD_ARGS -o
./${
GO_BIN_
DIR}/${CI_PROJECT_NAME}
.
-
go build $GO_BUILD_ARGS -o
$
GO_BIN_
PATH
.
artifacts
:
paths
:
-
./${
GO_BIN_
DIR}/${CI_PROJECT_NAME}
*
-
$
GO_BIN_
PATH
*
publish application
:
stage
:
"
publish"
needs
:
[
build application
]
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "release"
when
:
always
-
if
:
$CI_COMMIT_REF_NAME =~ /release/
before_script
:
-
apk update
-
apk add ca-certificates curl
@@ -51,5 +52,5 @@ publish application:
-
|
curl \
--header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
--upload-file
./${
GO_BIN_
DIR}/${CI_PROJECT_NAME}
* \
--upload-file
$
GO_BIN_
PATH
* \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/${version}/"
\ No newline at end of file
Loading