SAP / jenkins-library

Jenkins shared library for Continuous Delivery pipelines.
https://www.project-piper.io
Apache License 2.0
779 stars 589 forks source link

fixes `go build` on windows #4858

Closed hilmarf closed 7 months ago

hilmarf commented 7 months ago

Currently the go build fails on windows machines with the following error:

cmd\cnbBuild.go:589:3: unknown field Credential in struct literal of type "syscall".SysProcAttr
cmd\cnbBuild.go:589:24: undefined: syscall.Credential

Because on Windows the exec_windows.go contains the struct like this:

type SysProcAttr struct {
    HideWindow                 bool
    CmdLine                    string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess
    CreationFlags              uint32
    Token                      Token               // if set, runs new process in the security context represented by the token
    ProcessAttributes          *SecurityAttributes // if set, applies these security attributes as the descriptor for the new process
    ThreadAttributes           *SecurityAttributes // if set, applies these security attributes as the descriptor for the main thread of the new process
    NoInheritHandles           bool                // if set, no handles are inherited by the new process, not even the standard handles, contained in ProcAttr.Files, nor the ones contained in AdditionalInheritedHandles
    AdditionalInheritedHandles []Handle            // a list of additional handles, already marked as inheritable, that will be inherited by the new process
    ParentProcess              Handle              // if non-zero, the new process regards the process given by this handle as its parent process, and AdditionalInheritedHandles, if set, should exist in this parent process
}

Which obviously doesn't have Credential

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

hilmarf commented 7 months ago

@pbusko / @kulhadia / @modulo11 - may I ask you to take a look at this PR and maybe approve?

It makes local development and testing/debugging on Windows a lot easier. Thanks!

🖖 live long and prosper Hilmar

tiloKo commented 7 months ago

highly appreciated - these errors drive me crazy

tiloKo commented 7 months ago

/it

hilmarf commented 7 months ago

@tiloKo thanks for the approval and the trigger of the integration tests... any idea why they are failing? The error message is a bit short and I can't see a relationship to my changes :-(

tiloKo commented 7 months ago

@tiloKo thanks for the approval and the trigger of the integration tests... any idea why they are failing? The error message is a bit short and I can't see a relationship to my changes :-(

honestly for my PRs I ignore the consumer tests as they seem to never work. the normal integration tests contain tests for this step and they were successful. The consumer tests seem to test other steps, e.g. mtabuild and tmsupload so I would vote for just ignoring them

hilmarf commented 7 months ago

honestly for my PRs I ignore the consumer tests as they seem to never work. the normal integration tests contain tests for this step and they were successful. The consumer tests seem to test other steps, e.g. mtabuild and tmsupload so I would vote for just ignoring them

fine with me :-)

@tiloKo do you have write permissions? Because I don't... who can now merge it?