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
ludo8147
webservice
Commits
7e3e336a
Commit
7e3e336a
authored
7 months ago
by
ludo8147
Browse files
Options
Downloads
Patches
Plain Diff
corrected yaml
parent
7433a437
No related branches found
No related tags found
No related merge requests found
Pipeline
#69238
failed
7 months ago
Stage: build
Stage: test
Stage: publish
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+12
-19
12 additions, 19 deletions
.gitlab-ci.yml
with
12 additions
and
19 deletions
.gitlab-ci.yml
+
12
−
19
View file @
7e3e336a
#Code: https://github.com/lucendio/lecture-devops-code/blob/master/tutorials/define-and-run-pipeline/.gitlab-ci.yml
# und Vorlesung
#https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html
#https://docs.gitlab.com/ee/ci/yaml/workflow.html
workflow
:
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
when
:
always
variables
:
version
:
0.0.$CI_PIPELINE_IID
stages
:
-
'
build'
-
'
test'
...
...
@@ -24,41 +22,36 @@ job_build:
image
:
'
mirror.gcr.io/library/golang:1.21'
parallel
:
matrix
:
-
GOOS
:
-
'
linux'
-
'
windows'
-
'
darwin'
GOARCH
:
-
'
amd64'
-
'
arm64'
-
GOOS
:
[
'
linux'
,
'
windows'
,
'
darwin'
]
GOARCH
:
[
'
amd64'
,
'
arm64'
]
before_script
:
-
mkdir -p ./artifacts
script
:
script
:
-
|
go build \
-o ./artifacts/webservice_${GOOS}_${GOARCH}.bin \
./*.go
go build \
-o ./artifacts/webservice_${GOOS}_${GOARCH}.bin \
./*.go
artifacts
:
paths
:
-
./artifacts
job_publish
:
stage
:
'
publish'
rules
:
image
:
'
public.ecr.aws/lts/ubuntu:22.04'
tags
:
-
docker-privileged
dependencies
:
-
job_build
before
-
script
:
before
_
script
:
-
apt update
-
apt install -y ca-certificates curl
-
update-ca-certificates
script
:
-
|
for artifact in ./artifacts/*; do
chmod +x ${artifact}
curl \
--header "Job-TOKEN: ${CI_JOB_TOKEN}" \
--upload-file ${artifact} \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/
latest
/"
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/artifacts/
${version}
/"
done
\ 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