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
aee5c224
Commit
aee5c224
authored
7 months ago
by
ludo8147
Browse files
Options
Downloads
Patches
Plain Diff
define and run a pipeline
parent
644378e6
No related branches found
No related tags found
No related merge requests found
Pipeline
#69215
passed
7 months ago
Stage: build
Stage: test
Stage: publish
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+37
-28
37 additions, 28 deletions
.gitlab-ci.yml
Define and run a pipeline/.gitlab-ci.yml
+1
-0
1 addition, 0 deletions
Define and run a pipeline/.gitlab-ci.yml
with
38 additions
and
28 deletions
.gitlab-ci.yml
+
37
−
28
View file @
aee5c224
#
Code
aus Vorlesung
#
https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html
#
https://docs.gitlab.com/ee/
ci/docker/using_docker_build
.html
#
https://docs.gitlab.com/ee/ci/
services/
#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
:
...
...
@@ -9,7 +9,7 @@ workflow:
when
:
always
variables
:
CONTAINER_RELEASE_IMAGE
:
$CI_REGISTRY_IMAGE:latest
version
:
0.0.$CI_PIPELINE_IID
stages
:
-
'
build'
...
...
@@ -23,38 +23,47 @@ job_test:
-
go test -race -v ./...
job_build
:
stage
:
build
image
:
mirror.gcr.io/library/golang:1.21
stage
:
'
build'
image
:
'
mirror.gcr.io/library/golang:1.21'
parallel
:
matrix
:
-
GOOS
:
-
'
linux'
-
'
windows'
-
'
darwin'
GOARCH
:
-
'
amd64'
-
'
arm64'
before_script
:
-
mkdir -p ./artifacts
script
:
-
go get -t ./...
-
GOOS=linux GOARCH=amd64 CGO_ENABLED=0
go build
-o ./artifact.bin
script
:
-
|
go build \
-o ./artifacts/webservice_${GOOS}_${GOARCH}.bin \
./*.go
artifacts
:
paths
:
-
./artifact.bin
expire_in
:
10 sec
-
./artifacts
job_upload
:
stage
:
publish
image
:
registry.hub.docker.com/library/docker:24.0.7
job_publish
:
stage
:
'
publish'
rules
:
image
:
'
public.ecr.aws/lts/ubuntu:22.04'
tags
:
-
docker-privileged
dependencies
:
-
job_build
services
:
-
name
:
registry.hub.docker.com/library/docker:24.0.7-dind
before_script
:
-
apt update
-
apt install -y ca-certificates curl
-
update-ca-certificates
script
:
echo ${CONTAINER_RELEASE_IMAGE}
- docker build
--file ./Containerfile
--tag "${CONTAINER_RELEASE_IMAGE}"
./
- docker push $CONTAINER_RELEASE_IMAGE
after_script
:
-
docker image rm --force "${CONTAINER_RELEASE_IMAGE}"
-
|
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/${version}/"
done
This diff is collapsed.
Click to expand it.
Define and run a pipeline/.gitlab-ci.yml
+
1
−
0
View file @
aee5c224
#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
workflow
:
rules
:
...
...
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