fix: merge jobs failing #63

Merged
jon_nfc merged 5 commits from 6-fix-merging-jobs-failing into development 2022-01-16 00:05:30 +00:00
jon_nfc commented 2022-01-15 04:40:28 +00:00 (Migrated from gitlab.com)

📚 Summary

Fix failures when merging

Also ensure jobs that shouldn't run on master dont trigger.


🔗 Related Issue(s) 🔗 Related Merge Request(s)
Fixes #6 !11
!12

👷 Tasks

  • don't run job on master

    • commit footer refs

    • PyLint

  • #6 resolved and tested

  • merging to correct branch?

  • issue linked to this MR?

  • related issues:

    • closed in a commit message

    • Manually closed

    • All related issues tasks complete?

## :books: Summary Fix failures when merging Also ensure jobs that shouldn't run on master dont trigger. ----- | :link: **Related Issue(s)** | :link: **Related Merge Request(s)** | |:----:|:----:| | **Fixes #6** | !11 <br> !12 | - https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/pipelines/448649201 - **failed job** https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/pipelines/448649199 ### :construction_worker: Tasks - [ ] don't run job on master - [ ] commit footer refs - [ ] PyLint - [x] #6 resolved and tested <!-- dont remove tasks strike through including the checkbox by enclosing in double tidle '~~' --> - [x] merging to correct branch? - [x] issue linked to this MR? - related issues: - [x] closed in a commit message - [ ] Manually closed - [x] All related issues tasks complete? <!-- don't adjust the below slash commands -->
jon_nfc commented 2022-01-15 04:40:28 +00:00 (Migrated from gitlab.com)

requested review from @jon_nfc

requested review from @jon_nfc
jon_nfc commented 2022-01-15 04:40:28 +00:00 (Migrated from gitlab.com)

assigned to @jon_nfc

assigned to @jon_nfc
jon_nfc commented 2022-01-15 04:50:29 +00:00 (Migrated from gitlab.com)

Commit.py changes

commit.py Line 44

Change to

url = 'https://gitlab.com/api/v4/projects/' + project_id + '/merge_requests?state=opened'

# Commit.py changes [commit.py Line 44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/blob/de3cd5ab629d7eb2b6db4b4f1bfa78026356b30b/conventional_commits/scripts/commit.py#L44) Change to ``` python url = 'https://gitlab.com/api/v4/projects/' + project_id + '/merge_requests?state=opened' ```
jon_nfc commented 2022-01-15 04:50:29 +00:00 (Migrated from gitlab.com)

added 20m of time spent

added 20m of time spent
jon_nfc commented 2022-01-15 04:51:26 +00:00 (Migrated from gitlab.com)

Patch

diff --git a/conventional_commits/scripts/commit.py b/conventional_commits/scripts/commit.py
index 0adb4b6..73c120f 100755
--- a/conventional_commits/scripts/commit.py
+++ b/conventional_commits/scripts/commit.py
@@ -77,7 +77,7 @@ if not isinstance(merge_requests, list):
 #mrs = gl.mergerequests.list()
 
 
-mr_title = ''
+mr_title = 'ci: No Merge Request found'
 mr_first_commit = ''
 target_branch = ''
 
## Patch ``` patch diff --git a/conventional_commits/scripts/commit.py b/conventional_commits/scripts/commit.py index 0adb4b6..73c120f 100755 --- a/conventional_commits/scripts/commit.py +++ b/conventional_commits/scripts/commit.py @@ -77,7 +77,7 @@ if not isinstance(merge_requests, list): #mrs = gl.mergerequests.list() -mr_title = '' +mr_title = 'ci: No Merge Request found' mr_first_commit = '' target_branch = '' ```
jon_nfc commented 2022-01-15 04:52:02 +00:00 (Migrated from gitlab.com)

Also edit the mr job with the following

Adjusts to adding mr title to a variable that can be seen in the job log.

MR Title:
    extends:
        - .conventional_commit
    script:
        - MR_TITLE=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH)
        - echo "[DEBUG] MR_TITLE[$MR_TITLE]"
        - cz_exit=0 && cz check --message "$MR_TITLE" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?
        - . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml"

Also edit the mr job with the following Adjusts to adding mr title to a variable that can be seen in the job log. ``` yaml MR Title: extends: - .conventional_commit script: - MR_TITLE=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH) - echo "[DEBUG] MR_TITLE[$MR_TITLE]" - cz_exit=0 && cz check --message "$MR_TITLE" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$? - . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml" ```
jon_nfc commented 2022-01-15 04:55:32 +00:00 (Migrated from gitlab.com)

PyLint .gitlab-ci.yml Lines 48-51

    rules:
        - if: '$CI_COMMIT_BRANCH == "master"'
          when: never
        - if: '$CI_COMMIT_BRANCH'
          when: always
        - when: never


PyLint [.gitlab-ci.yml Lines 48-51](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/blob/de3cd5ab629d7eb2b6db4b4f1bfa78026356b30b/python/.gitlab-ci.yml#L48-L51) ``` yaml rules: - if: '$CI_COMMIT_BRANCH == "master"' when: never - if: '$CI_COMMIT_BRANCH' when: always - when: never ```
jon_nfc commented 2022-01-15 04:58:43 +00:00 (Migrated from gitlab.com)

Commit footer refs .gitlab-ci.yml lines 87-93

    rules:
        - if: '$CI_COMMIT_BRANCH == "master"'
          when: never
        - if: '$CI_COMMIT_BRANCH == "development"'
          when: never
        - if: '$CI_COMMIT_BRANCH && $CHANGELOG_FOOTER_REFERENCES != "False"'
          when: always
        - when: never


Commit footer refs [.gitlab-ci.yml lines 87-93](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/blob/de3cd5ab629d7eb2b6db4b4f1bfa78026356b30b/gitlab_release/.gitlab-ci.yml#L87-L93) ``` yaml rules: - if: '$CI_COMMIT_BRANCH == "master"' when: never - if: '$CI_COMMIT_BRANCH == "development"' when: never - if: '$CI_COMMIT_BRANCH && $CHANGELOG_FOOTER_REFERENCES != "False"' when: always - when: never ```
jon_nfc commented 2022-01-15 05:00:18 +00:00 (Migrated from gitlab.com)

Ignore this change as pylint can stay due to it being a check on the branch.

Ignore this change as pylint can stay due to it being a check on the branch.
jon_nfc commented 2022-01-15 05:03:16 +00:00 (Migrated from gitlab.com)

Task needs to run on master.

Yaml lint .gitlab-ci.yml lines 38-43

    rules:
        - if: '$CI_COMMIT_BRANCH'
          when: always
        - when: never


# Task needs to run on master. Yaml lint [.gitlab-ci.yml lines 38-43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/blob/de3cd5ab629d7eb2b6db4b4f1bfa78026356b30b/yaml_lint/.gitlab-ci.yml#L38-L43) ``` yaml rules: - if: '$CI_COMMIT_BRANCH' when: always - when: never ```
jon_nfc commented 2022-01-15 05:04:50 +00:00 (Migrated from gitlab.com)

added 14m of time spent

added 14m of time spent
jon_nfc commented 2022-01-15 05:05:17 +00:00 (Migrated from gitlab.com)

marked the checklist item merging to correct branch? as completed

marked the checklist item **merging to correct branch?** as completed
jon_nfc commented 2022-01-15 05:05:19 +00:00 (Migrated from gitlab.com)

marked the checklist item issue linked to this MR? as completed

marked the checklist item **issue linked to this MR?** as completed
jon_nfc commented 2022-01-15 05:47:09 +00:00 (Migrated from gitlab.com)

repo README.md update

Add badges

  • active

  • branch versions

# repo README.md update Add badges - active - branch versions
jon_nfc commented 2022-01-15 23:12:33 +00:00 (Migrated from gitlab.com)

Added.

Added.
jon_nfc commented 2022-01-15 23:23:08 +00:00 (Migrated from gitlab.com)

added and also an additional filter so that the current branch is searched for.

added and also an additional filter so that the current branch is searched for.
jon_nfc commented 2022-01-15 23:26:01 +00:00 (Migrated from gitlab.com)

added

added
jon_nfc commented 2022-01-15 23:29:42 +00:00 (Migrated from gitlab.com)

added.

added.
jon_nfc commented 2022-01-15 23:30:42 +00:00 (Migrated from gitlab.com)

added 3 commits

  • 73918f2f - fix(commit.py): filter merge request search to 'opened' and on current branch.
  • 251aeb13 - ci(MR Title): save the merge request title as a variable and debug output in job log.
  • dd554aae - feat(commit_footer_refs): never run on development or master.

Compare with previous version

added 3 commits <ul><li>73918f2f - fix(commit.py): filter merge request search to &#39;opened&#39; and on current branch.</li><li>251aeb13 - ci(MR Title): save the merge request title as a variable and debug output in job log.</li><li>dd554aae - feat(commit_footer_refs): never run on development or master.</li></ul> [Compare with previous version](/nofusscomputing/projects/gitlab-ci/-/merge_requests/13/diffs?diff_id=312179085&start_sha=5c9000a74859504ed64bbefa1fd193f80a2b69c2)
jon_nfc commented 2022-01-15 23:34:37 +00:00 (Migrated from gitlab.com)

added 2 commits

  • 31517b4b - ci(MR_Title): save the merge request title as a variable and debug output in job log.
  • 82c6c9f5 - feat(commit_footer_refs): never run on development or master.

Compare with previous version

added 2 commits <ul><li>31517b4b - ci(MR_Title): save the merge request title as a variable and debug output in job log.</li><li>82c6c9f5 - feat(commit_footer_refs): never run on development or master.</li></ul> [Compare with previous version](/nofusscomputing/projects/gitlab-ci/-/merge_requests/13/diffs?diff_id=312179240&start_sha=dd554aae7dd23a8ef09e30ac6c6e025802f295cd)
jon_nfc commented 2022-01-15 23:37:31 +00:00 (Migrated from gitlab.com)

added.

added.
jon_nfc commented 2022-01-15 23:37:42 +00:00 (Migrated from gitlab.com)

resolved all threads

resolved all threads
jon_nfc commented 2022-01-15 23:56:14 +00:00 (Migrated from gitlab.com)

added 2 commits

  • 140985c3 - feat(.yaml_lint_defaults): Always run on all branches as this denotes quality.
  • f4670844 - docs(README.md): Added project header template

Compare with previous version

added 2 commits <ul><li>140985c3 - feat(.yaml_lint_defaults): Always run on all branches as this denotes quality.</li><li>f4670844 - docs(README.md): Added project header template</li></ul> [Compare with previous version](/nofusscomputing/projects/gitlab-ci/-/merge_requests/13/diffs?diff_id=312180388&start_sha=82c6c9f5d53594544cea9a7bc59a10ab1e9ebedd)
jon_nfc commented 2022-01-15 23:58:50 +00:00 (Migrated from gitlab.com)

mentioned in issue #6

mentioned in issue #6
jon_nfc commented 2022-01-15 23:59:35 +00:00 (Migrated from gitlab.com)

marked the checklist item closed in a commit message as completed

marked the checklist item **closed in a commit message** as completed
jon_nfc commented 2022-01-16 00:00:03 +00:00 (Migrated from gitlab.com)

marked the checklist item All related issues tasks complete? as completed

marked the checklist item **All related issues tasks complete?** as completed
jon_nfc commented 2022-01-16 00:00:08 +00:00 (Migrated from gitlab.com)

marked the checklist item #6 resolved and tested as completed

marked the checklist item **#6 resolved and tested** as completed
jon_nfc commented 2022-01-16 00:05:30 +00:00 (Migrated from gitlab.com)

mentioned in commit 1093b380cb

mentioned in commit 1093b380cbbb7e30364121a20b00452f47534f32
jon_nfc (Migrated from gitlab.com) merged commit 1093b380cb into development 2022-01-16 00:05:30 +00:00
jon_nfc commented 2022-01-16 00:05:54 +00:00 (Migrated from gitlab.com)

added 53m of time spent

added 53m of time spent
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: infrastructure/gitlab-ci#63
No description provided.