Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Documentation
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Helmholtz Metadata Collaboration
HMC Public
unHIDE
Documentation
Commits
5675a04b
Verified
Commit
5675a04b
authored
4 days ago
by
Mustafa Soylu
Browse files
Options
Downloads
Patches
Plain Diff
build for all, push image for merge and deploy only on merge
parent
c2a6899d
No related branches found
No related tags found
No related merge requests found
Pipeline
#513566
passed
4 days ago
Stage: build
Stage: sync
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+12
-14
12 additions, 14 deletions
.gitlab-ci.yml
with
12 additions
and
14 deletions
.gitlab-ci.yml
+
12
−
14
View file @
5675a04b
...
...
@@ -24,19 +24,18 @@ build_dev:
# Build the image with the SHA-specific tag
-
docker build --build-arg SERVER_URL="https://docs.dev.unhide.helmholtz-metadaten.de/" --build-arg NODE_ENV=dev -t "$IMAGE_NAME_SHA" .
# Tag the image as 'develop:latest'
-
docker tag "$IMAGE_NAME_SHA" "$IMAGE_NAME"
# Push both tags
-
docker push "$IMAGE_NAME_SHA"
-
docker push "$IMAGE_NAME"
# Save IMAGE_NAME_SHA to a file
-
echo "$IMAGE_NAME_SHA" > image_name_sha.txt
# Only push the image if it's a direct commit to `dev`
-
|
if [ "$CI_COMMIT_BRANCH" == "dev" ] && [ "$CI_PIPELINE_SOURCE" == "push" ]; then
docker tag "$IMAGE_NAME_SHA" "$IMAGE_NAME"
docker push "$IMAGE_NAME_SHA"
docker push "$IMAGE_NAME"
echo "$IMAGE_NAME_SHA" > image_name_sha.txt
fi
artifacts
:
paths
:
-
image_name_sha.txt
expire_in
:
1 hour
# Optional: Set how long the artifact is kept
expire_in
:
1 hour
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"dev"'
exists
:
...
...
@@ -50,7 +49,7 @@ update_manifests_dev:
variables
:
MANIFESTS_REPO
:
'
https://codebase.helmholtz.cloud/hmc/hmc-public/unhide/development/devops/documentation-manifests.git'
dependencies
:
-
build_dev
# Ensure the artifact is downloaded from the build_dev job
-
build_dev
before_script
:
-
git config --global user.name "GitLab CI"
-
git config --global user.email "ci@backend.manifests"
...
...
@@ -74,7 +73,6 @@ update_manifests_dev:
-
git commit -m "Update image to $IMAGE_NAME_SHA"
-
git push
artifacts
:
expire_in
:
1 hour
# Optional: Set artifact expiration for the sync job
expire_in
:
1 hour
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"dev"'
-
if
:
'
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
==
"dev"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"dev"
&&
$CI_PIPELINE_SOURCE
==
"push"'
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