Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#234: Do not require a workspace to notify Bitbucket #425

Open
wants to merge 1 commit into
base: release/1.x
Choose a base branch
from

Conversation

nathanhi
Copy link

@nathanhi nathanhi commented Dec 9, 2024

Implements #234

Historically, the stashNotifier plugin required a workspace context in order to perform the plugin task, albeit not making use of the workspace in any way.

This change removes the implementation of the perform method requiring a workspace and replaces it with the one not requiring a workspace.

Testing done

Regular pipeline (without workspace)

Created a simple Pipeline checking out a Git repository on a specific node with the pipeline not requiring one; notifications work as intended:

pipeline {
    agent none

    stages {
        stage('Hello') {
            agent {
                label 'linux'
            }

            steps {
                git branch: 'foo', changelog: false, credentialsId: '****', poll: false, url: '****/jenkins_bitbucket_notifier.git'
                echo 'Hello World'
            }
        }
    }

    post {
        always {
            notifyBitbucket()
        }
    }
}

Regular pipeline (with workspace)

Created a simple Pipeline that allocates a node top-level; notifications work as intended/before:

pipeline {
    agent {
        label 'linux'
    }

    stages {
        stage('Hello') {
            steps {
                git branch: 'foo', changelog: false, credentialsId: '****', poll: false, url: '****/jenkins_bitbucket_notifier.git'
                echo 'Hello World'
            }
        }
    }

    post {
        always {
            notifyBitbucket()
        }
    }
}

Regular pipeline (with node(null) in post)

pipeline {
    agent none

    stages {
        stage('Hello') {
            agent {
                label 'linux'
            }

            steps {
                git branch: 'foo', changelog: false, credentialsId: '****', poll: false, url: '****/jenkins_bitbucket_notifier.git'
                echo 'Hello World'
            }
        }
    }

    post {
        always {
            script {
                node(null) {
                    notifyBitbucket()
                }
            }
        }
    }
}

Freestyle job

Triggered a freestyle build with a post-build action to notify Bitbucket -> still works as intended (pre- and post-build notifications are sent).

Submitter checklist

  • 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

Historically, the stashNotifier plugin required a workspace
context in order to perform the plugin task, albeit not
making use of the workspace in any way.

This change removes the implementation of the perform
method requiring a workspace and replaces it with the
one not requiring a workspace.
@nathanhi nathanhi requested a review from a team as a code owner December 9, 2024 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant