Loading capif/.gitlab-ci.yml +28 −28 Original line number Diff line number Diff line Loading @@ -74,26 +74,26 @@ variables: tags: - shell main_cancel_previous_action: stage: main_pre_pipeline script: - | if [[ -n "$CI_JOB_TOKEN" ]]; then echo "Checking for running jobs in the same pipeline..." jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") for job in $(echo "$jobs" | jq -r '.[] | @base64'); do _jq() { echo ${job} | base64 --decode | jq -r ${1} } status=$(_jq '.status') id=$(_jq '.id') if [[ "$status" == "running" ]] && [[ "$id" != "$CI_JOB_ID" ]]; then echo "Cancelling job $id" curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/jobs/$id/cancel" fi done fi <<: *main_common #main_cancel_previous_action: # stage: main_pre_pipeline # script: # - | # if [[ -n "$CI_JOB_TOKEN" ]]; then # echo "Checking for running jobs in the same pipeline..." # jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") # for job in $(echo "$jobs" | jq -r '.[] | @base64'); do # _jq() { # echo ${job} | base64 --decode | jq -r ${1} # } # status=$(_jq '.status') # id=$(_jq '.id') # if [[ "$status" == "running" ]] && [[ "$id" != "$CI_JOB_ID" ]]; then # echo "Cancelling job $id" # curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/jobs/$id/cancel" # fi # done # fi # <<: *main_common merge_request_staging_into_main: stage: merge_request_staging_into_main Loading Loading @@ -239,8 +239,8 @@ container_scanning: - when: never main_semgrep_sast: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: semgrep-sast variables: Loading @@ -251,8 +251,8 @@ main_semgrep_sast: <<: *main_dnd main_kubesec_sast: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: kubesec-sast before_script: Loading @@ -268,8 +268,8 @@ main_kubesec_sast: <<: *main_dnd main_gemnasium_python_dependency_scanning: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: gemnasium-python-dependency_scanning variables: Loading @@ -277,8 +277,8 @@ main_gemnasium_python_dependency_scanning: <<: *main_dnd main_secret_detection: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: secret_detection variables: Loading capif/templates/ci_dev.gitlab-ci.yml +10 −10 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ variables: # - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git # <<: *dev_common dev_cancel_previous_action: stage: dev_pre_pipeline script: - | echo "### cancel previous actions in dev branchc ###" #dev_cancel_previous_action: # stage: dev_pre_pipeline # script: # - | # echo "### cancel previous actions in dev branchc ###" # if [[ -n "$CI_JOB_TOKEN" ]]; then # echo "Checking for running jobs in the same pipeline..." # jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") Loading @@ -43,13 +43,13 @@ dev_cancel_previous_action: # fi # done # fi rules: - if: $CI_COMMIT_BRANCH <<: *dev_common # rules: # - if: $CI_COMMIT_BRANCH # <<: *dev_common dev_secrets_in_repo: needs: - dev_cancel_previous_action # needs: # - dev_cancel_previous_action stage: dev_secrets_in_repo script: - | Loading capif/templates/ci_staging.gitlab-ci.yml +8 −8 Original line number Diff line number Diff line Loading @@ -41,11 +41,11 @@ variables: # - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git # <<: *staging_common staging_cancel_previous_action: stage: staging_pre_pipeline script: - | echo "### cancel previous actions in dev branchc ###" #staging_cancel_previous_action: # stage: staging_pre_pipeline # script: # - | # echo "### cancel previous actions in dev branchc ###" # if [[ -n "$CI_JOB_TOKEN" ]]; then # echo "Checking for running jobs in the same pipeline..." # jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") Loading @@ -61,7 +61,7 @@ staging_cancel_previous_action: # fi # done # fi <<: *staging_common # <<: *staging_common staging_secrets_in_repo: stage: staging_secrets_in_repo Loading @@ -70,8 +70,8 @@ staging_secrets_in_repo: pip install trufflehog cd ../ trufflehog capif --exclude_paths capif/cicd/exclusions --max_depth=5 needs: - staging_cancel_previous_action # needs: # - staging_cancel_previous_action <<: *staging_common # define the process to do linting code: Sonarque, ruff? Loading Loading
capif/.gitlab-ci.yml +28 −28 Original line number Diff line number Diff line Loading @@ -74,26 +74,26 @@ variables: tags: - shell main_cancel_previous_action: stage: main_pre_pipeline script: - | if [[ -n "$CI_JOB_TOKEN" ]]; then echo "Checking for running jobs in the same pipeline..." jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") for job in $(echo "$jobs" | jq -r '.[] | @base64'); do _jq() { echo ${job} | base64 --decode | jq -r ${1} } status=$(_jq '.status') id=$(_jq '.id') if [[ "$status" == "running" ]] && [[ "$id" != "$CI_JOB_ID" ]]; then echo "Cancelling job $id" curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/jobs/$id/cancel" fi done fi <<: *main_common #main_cancel_previous_action: # stage: main_pre_pipeline # script: # - | # if [[ -n "$CI_JOB_TOKEN" ]]; then # echo "Checking for running jobs in the same pipeline..." # jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") # for job in $(echo "$jobs" | jq -r '.[] | @base64'); do # _jq() { # echo ${job} | base64 --decode | jq -r ${1} # } # status=$(_jq '.status') # id=$(_jq '.id') # if [[ "$status" == "running" ]] && [[ "$id" != "$CI_JOB_ID" ]]; then # echo "Cancelling job $id" # curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/jobs/$id/cancel" # fi # done # fi # <<: *main_common merge_request_staging_into_main: stage: merge_request_staging_into_main Loading Loading @@ -239,8 +239,8 @@ container_scanning: - when: never main_semgrep_sast: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: semgrep-sast variables: Loading @@ -251,8 +251,8 @@ main_semgrep_sast: <<: *main_dnd main_kubesec_sast: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: kubesec-sast before_script: Loading @@ -268,8 +268,8 @@ main_kubesec_sast: <<: *main_dnd main_gemnasium_python_dependency_scanning: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: gemnasium-python-dependency_scanning variables: Loading @@ -277,8 +277,8 @@ main_gemnasium_python_dependency_scanning: <<: *main_dnd main_secret_detection: needs: - main_cancel_previous_action # needs: # - main_cancel_previous_action stage: main_sast extends: secret_detection variables: Loading
capif/templates/ci_dev.gitlab-ci.yml +10 −10 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ variables: # - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git # <<: *dev_common dev_cancel_previous_action: stage: dev_pre_pipeline script: - | echo "### cancel previous actions in dev branchc ###" #dev_cancel_previous_action: # stage: dev_pre_pipeline # script: # - | # echo "### cancel previous actions in dev branchc ###" # if [[ -n "$CI_JOB_TOKEN" ]]; then # echo "Checking for running jobs in the same pipeline..." # jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") Loading @@ -43,13 +43,13 @@ dev_cancel_previous_action: # fi # done # fi rules: - if: $CI_COMMIT_BRANCH <<: *dev_common # rules: # - if: $CI_COMMIT_BRANCH # <<: *dev_common dev_secrets_in_repo: needs: - dev_cancel_previous_action # needs: # - dev_cancel_previous_action stage: dev_secrets_in_repo script: - | Loading
capif/templates/ci_staging.gitlab-ci.yml +8 −8 Original line number Diff line number Diff line Loading @@ -41,11 +41,11 @@ variables: # - git clone https://oauth2:${CI_JOB_TOKEN}@labs.etsi.org/rep/ocf/capif.git # <<: *staging_common staging_cancel_previous_action: stage: staging_pre_pipeline script: - | echo "### cancel previous actions in dev branchc ###" #staging_cancel_previous_action: # stage: staging_pre_pipeline # script: # - | # echo "### cancel previous actions in dev branchc ###" # if [[ -n "$CI_JOB_TOKEN" ]]; then # echo "Checking for running jobs in the same pipeline..." # jobs=$(curl --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "$GITLAB_API/projects/$CI_PROJECT_ID/pipelines/$CI_PIPELINE_ID/jobs") Loading @@ -61,7 +61,7 @@ staging_cancel_previous_action: # fi # done # fi <<: *staging_common # <<: *staging_common staging_secrets_in_repo: stage: staging_secrets_in_repo Loading @@ -70,8 +70,8 @@ staging_secrets_in_repo: pip install trufflehog cd ../ trufflehog capif --exclude_paths capif/cicd/exclusions --max_depth=5 needs: - staging_cancel_previous_action # needs: # - staging_cancel_previous_action <<: *staging_common # define the process to do linting code: Sonarque, ruff? Loading