1

Context:

  • featureBranch has been forked from sprintBranch and now needs to be merged into it

  • file[A-C] where changed in featureBranch creating a conflict with sprintBranch

  • changes from featureBranch are to be kept

  • after a merge of sprintBranch into featureBranch (no files were changed in sprintBranch pipelines in jenkins have started to fail

    $ git log commit ce90629c1f6a796a9e1b9ebf9f03641ecffeeabd (HEAD -> featureBranch, origin/featureBranch) Merge: f261cec59 dca640165 Author: userA Date: Wed Aug 3

     Merge remote-tracking branch 'sprintBranch' into 'featureBranch'
    
     # Conflicts:
     #       code/fileA
     #       code/fileB
     #       code/fileC
    
    commit f261cec591f05979c769c272ef2cba135414a6e9
    Author: userB
    Date:   Wed Aug 3 
    
     Commit msg #1
    
    commit e22e68756637ed7e628a2de6e45bf8b36f5a5127
    Author: userB
    Date:   Tue Aug 2 
    
     Commit msg #2
    

After conflicts were resolved and a push was made to origin/featureBranch even though there were no changes, the following occurs on jenkins that uses the following pipeline:

Nodes.node(this, "name", "proj") { podLabel ->
    node(podLabel) {
        try {
            stage('Checkout') {
                cleanWs()
                checkout scm
            }
            LongCommitID = sh(returnStdout: true, script: "git rev-parse HEAD").trim()

            SdkNotifier.buildStarted("bitbucketURL",
                    credentials,
                    LongCommitID,
                    BitbucketAccessToken)
                    

producing:

  hudson.remoting.ProxyException: groovy.lang.MissingPropertyException: No such property: LongCommitID for class: WorkflowScript
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:66)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.getProperty(ScriptBytecodeAdapter.java:471)
    at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:355)
    at org.kohsuke.groovy.sandbox.GroovyInterceptor.onGetProperty(GroovyInterceptor.java:68)
    at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:313)    

Running locally we get the HEAD correctly.

$ git rev-parse HEAD
ce90629c1f6a796a9e1b9ebf9f03641ecffeeabd

If the files that are in conflict in the current branch that is to be merged into another, are left unchanged in the current branch, where are they being pushed to? The target branch, right?

torek
  • 448,244
  • 59
  • 642
  • 775
Sebi
  • 4,262
  • 13
  • 60
  • 116
  • 1
    See [What are 'properties' in Groovy?](https://stackoverflow.com/q/13225599/1256452), [groovy.lang.Binding difference between property and variable](https://stackoverflow.com/q/53594351/1256452), and [What is the difference between defining variables using def and without?](https://stackoverflow.com/q/39514795/1256452). Note in particular [Pom12's answer](https://stackoverflow.com/a/39531443/1256452) to the last question (and the note `but y definition will throw an exception.`) – torek Aug 04 '22 at 09:51

0 Answers0