Skip to content
Snippets Groups Projects
Commit 3098cb3d authored by Yana Kernerman's avatar Yana Kernerman Committed by Yana Kernerman
Browse files

adjust the rules for the jobs

parent 5f80e3be
No related branches found
No related tags found
1 merge request!23Tut01 test exercise
workflow: workflow:
rules: rules:
- if: >- - if: $CI_PIPELINE_SOURCE == "merge_request_event"
$CI_PIPELINE_SOURCE == "push"
when: 'always' when: 'always'
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_REF_NAME =~/main/
- when: 'never' - when: 'never'
stages: stages:
...@@ -21,7 +21,7 @@ job_test_the_code: ...@@ -21,7 +21,7 @@ job_test_the_code:
job_build_artifact: job_build_artifact:
stage: build stage: build
rules: # Conditions under which this job should run rules: # Conditions under which this job should run
- if: $CI_COMMIT_REF_NAME =~ /^.*$/ # Run this job for any branch or merge request event. - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # Run this job only for merge request event into main.
when: always when: always
image: registry.hub.docker.com/library/golang:1.21 image: registry.hub.docker.com/library/golang:1.21
script: script:
...@@ -35,7 +35,7 @@ job_build_artifact: ...@@ -35,7 +35,7 @@ job_build_artifact:
job_publish_artifact: job_publish_artifact:
stage: publish stage: publish
rules: # Conditions under which this job should run rules: # Conditions under which this job should run
- if: $CI_COMMIT_REF_NAME =~ /^.*$/ # Run this job for any branch or merge request event. - if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main" # Run this job only for merge request event into main.
when: always when: always
image: curlimages/curl:latest # Custom image with curl image: curlimages/curl:latest # Custom image with curl
tags: tags:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment