Skip to content

Conversation

@mifitous
Copy link
Contributor

Implement @cobexer request #176 (comment)
Add a checkbox to allow ignoring type in build StatusName

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@mifitous mifitous requested a review from jetersen as a code owner April 23, 2023 09:01
@mifitous mifitous force-pushed the discard-type-in-full-name branch from 1222fb0 to 9df28c7 Compare April 23, 2023 10:08
@mifitous
Copy link
Contributor Author

Hi @jetersen
Please kindly review and merge it?

String statusName = GitLabPipelineStatusNotifier.getStatusName(sourceContext, null, revision,
new hudson.EnvVars());

assertThat(statusName, is(GitLabPipelineStatusNotifier.GITLAB_PIPELINE_STATUS_PREFIX
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of referencing constants here, write the actual literal expected value. Changing the value is an API break essentially?

Started external GitLab pipeline can't finish if the plugin is updated in between - jenkins pipelines can "in theory" run across Jenkins restarts...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a similar issue when changing the project config Discover merge requests from forks:

  • old value: Discover merge requests from forks
  • new value: The current merge request revision

That has the side effect to report the job status to be reported as jenkinsci/mr-head on GitLab instead of jenkinsci/mr-merge.

You also end up with tons of pipeline jenkinsci/mr-merge the are "running" forever:

External pipeline in Jenkins

For me you just need to accept that and be prepared to run some curl command to make the pipeline green using the REST API: https://docs.gitlab.com/ee/api/commits.html#set-the-pipeline-status-of-a-commit

curl --location '****gitlab-server****/api/v4/projects/****project-id****/statuses/****commit-sha****' \
--header 'Content-Type: application/json' \
--header 'PRIVATE-TOKEN: ****************' \
--data '{
    "state": "success",
    "name": "jenkinsci/mr-merge"
}'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is an attempt to resolve such problems by removing the type from the pipeline name... because GitLab is not GitHub and - depending on how you use the branch source - the type may not make sense.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am well aware about what this change is about.

We are interested to have a single name instead of:
jenkinsci/branch and jenkins/mr-head

In order to avoid 2 external pipeline report in Jenkins…

<f:entry title="${%Overwrite full name}" field="buildStatusNameOverwrite">
<f:checkbox default="unchecked"/>
</f:entry>
<f:entry title="${%Do not append type in status name}" field="ignoreTypeInStatusName">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid a double negation here?

@jmini
Copy link
Contributor

jmini commented Jun 15, 2023

@mifitous I support your proposal to add this!

Let me know if I can help…

@jetersen jetersen added the enhancement New feature or request label Jun 15, 2023
@jetersen
Copy link
Member

There are currently conflicts, would you mind resolving them? 😓

@mifitous mifitous force-pushed the discard-type-in-full-name branch from 75e7bb3 to 5cb346c Compare June 15, 2023 20:07
@mifitous
Copy link
Contributor Author

There are currently conflicts, would you mind resolving them? 😓

Hi @jetersen : done

@jetersen jetersen merged commit 877fdc2 into jenkinsci:master Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants