Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
devops-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
Yana Kernerman
devops-webservice
Commits
1211859a
Commit
1211859a
authored
8 months ago
by
Yana Kernerman
Browse files
Options
Downloads
Plain Diff
Merge branch 'define_and_run_a_pipeline' into 'main'
trigger pipeline See merge request
s92604/devops-webservice!2
parents
e228d876
0fd3614e
No related branches found
No related tags found
1 merge request
!2
trigger pipeline
Pipeline
#68433
passed
8 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+10
-3
10 additions, 3 deletions
.gitlab-ci.yml
with
10 additions
and
3 deletions
.gitlab-ci.yml
+
10
−
3
View file @
1211859a
...
...
@@ -32,16 +32,20 @@ job_build_artifact:
-
./artifact.bin
expire_in
:
1 week
job_
publish_artifact
:
job_
build_and_publish_image
:
stage
:
publish
rules
:
# Conditions under which this job should run
-
if
:
$CI_PIPELINE_SOURCE == "push" && $CI_MERGE_COMMIT_REF_NAME =~ /main/
# Run this job only for merge request event into main.
when
:
always
image
:
curlimages/curl:latest
# Custom image with curl
image
:
docker:24.0.0
# Official Docker image with Docker client installed
services
:
-
docker:24.0.0-dind
# used to access the Docker daemon from within the CI job.
tags
:
-
docker-privileged
dependencies
:
-
job_build_artifact
before_script
:
-
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
# Log in to the container registry
script
:
-
echo "Publishing artifact..."
-
ls -al
# List files to confirm artifact.bin exists
...
...
@@ -57,4 +61,7 @@ job_publish_artifact:
--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"
-
docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
-
docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
after_script
:
-
docker rmi "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
# Clean up the image to free up space
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