Skip to content

Commit

Permalink
chore(deps): Update go version 1.24 (#5277)
Browse files Browse the repository at this point in the history
* Bump go version 1.23.4->1.24

* Update go version 1.24.0 for github workflows

* Update go version 1.23.4->1.24.0 for docker images

* Replace deprecated cipher.NewCFBDecrypter/NewCFBEncrypter

* Fix go vet error: non-constant format string

* Fix go vet error: non-constant format string

* Update cmd/golangBuild.go

Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>

---------

Co-authored-by: Ivan Nikiforov <ivan.nikiforov@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 27, 2025
1 parent 8be029f commit 26e145d
Show file tree
Hide file tree
Showing 46 changed files with 98 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'

- name: Install Groovy
run: sudo apt-get update && sudo apt-get install groovy -y
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-go-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- name: Perform update
run: |
git checkout -B gh-action-update-golang-dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload-go-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- env:
CGO_ENABLED: 0
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/verify-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: styfle/cancel-workflow-action@0.11.0
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- name: Cache Golang Packages
uses: actions/cache@v3
with:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- name: Cache Golang Packages
uses: actions/cache@v3
with:
Expand All @@ -63,7 +63,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- name: checkout
uses: actions/checkout@v4
with:
Expand All @@ -78,7 +78,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- name: Cache Golang Packages
uses: actions/cache@v3
with:
Expand All @@ -98,7 +98,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.23.4'
go-version: '1.24.0'
- name: Cache Golang Packages
uses: actions/cache@v3
with:
Expand Down
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23.4 AS build-env
FROM golang:1.24.0 AS build-env
COPY . /build
WORKDIR /build

Expand All @@ -11,13 +11,13 @@ RUN go test ./... -tags=unit -cover
RUN export GIT_COMMIT=$(git rev-parse HEAD) && \
export GIT_REPOSITORY=$(git config --get remote.origin.url) && \
CGO_ENABLED=0 go build \
-ldflags \
"-X github.com/SAP/jenkins-library/cmd.GitCommit=${GIT_COMMIT} \
-X github.com/SAP/jenkins-library/pkg/log.LibraryRepository=${GIT_REPOSITORY} \
-X github.com/SAP/jenkins-library/pkg/log.LibraryName=piper-lib-os \
-X github.com/SAP/jenkins-library/pkg/telemetry.LibraryRepository=${GIT_REPOSITORY}" \
-tags release \
-o piper
-ldflags \
"-X github.com/SAP/jenkins-library/cmd.GitCommit=${GIT_COMMIT} \
-X github.com/SAP/jenkins-library/pkg/log.LibraryRepository=${GIT_REPOSITORY} \
-X github.com/SAP/jenkins-library/pkg/log.LibraryName=piper-lib-os \
-X github.com/SAP/jenkins-library/pkg/telemetry.LibraryRepository=${GIT_REPOSITORY}" \
-tags release \
-o piper

# FROM gcr.io/distroless/base:latest
# COPY --from=build-env /build/piper /piper
Expand Down
2 changes: 1 addition & 1 deletion cmd/abapEnvironmentAssembleConfirm.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func startingConfirm(repos []abaputils.Repository, conn abapbuild.Connector, del
if releasePackagesFailed == nil {
releasePackagesFailed = errors.New(errormessage)
} else {
releasePackagesFailed = errors.Wrapf(releasePackagesFailed, errormessage)
releasePackagesFailed = errors.Wrap(releasePackagesFailed, errormessage)
}
} else {
log.Entry().Infof("Packages %s was not assembled in this pipeline run, thus no need to confirm", repo.PackageName)
Expand Down
10 changes: 5 additions & 5 deletions cmd/abapEnvironmentCloneGitRepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func cloneSingleRepo(apiManager abaputils.SoftwareComponentApiManagerInterface,

alreadyCloned, activeBranch, errCheckCloned, isByog := api.GetRepository()
if errCheckCloned != nil {
return errors.Wrapf(errCheckCloned, errorString)
return errors.Wrap(errCheckCloned, errorString)
}

if !alreadyCloned {
Expand All @@ -110,22 +110,22 @@ func cloneSingleRepo(apiManager abaputils.SoftwareComponentApiManagerInterface,
}
errClone := api.Clone()
if errClone != nil {
return errors.Wrapf(errClone, errorString)
return errors.Wrap(errClone, errorString)
}
// set correct filename for archive file
logOutputManager.FileNameStep = "clone"
status, errorPollEntity := abaputils.PollEntity(api, apiManager.GetPollIntervall(), logOutputManager)
if errorPollEntity != nil {
return errors.Wrapf(errorPollEntity, errorString)
return errors.Wrap(errorPollEntity, errorString)
}
if status == "E" {
return errors.New("Clone of " + logString + " failed on the ABAP System")
}
log.Entry().Info("The " + logString + " was cloned successfully")
} else {
abaputils.AddDefaultDashedLine(2)
log.Entry().Infof("%s", "The repository / software component has already been cloned on the ABAP Environment system ")
log.Entry().Infof("%s", "If required, a `checkout branch`, and a `pull` will be performed instead")
log.Entry().Info("The repository / software component has already been cloned on the ABAP Environment system ")
log.Entry().Info("If required, a `checkout branch`, and a `pull` will be performed instead")
abaputils.AddDefaultDashedLine(2)
var returnedError error
if repo.Branch != "" && !(activeBranch == repo.Branch) {
Expand Down
4 changes: 2 additions & 2 deletions cmd/abapEnvironmentCreateTag.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func createTags(backlog []abaputils.CreateTagBacklog, con abaputils.ConnectionDe

if errorOccurred {
message := "At least one tag has not been created"
log.Entry().Errorf(message)
log.Entry().Error(message)
return errors.New(message)
}
return nil
Expand Down Expand Up @@ -94,7 +94,7 @@ func createSingleTag(item abaputils.CreateTagBacklog, index int, con abaputils.C

createTagError := api.CreateTag(item.Tags[index])
if createTagError != nil {
return errors.Wrapf(err, "Creation of Tag failed on the ABAP system")
return errors.Wrap(err, "Creation of Tag failed on the ABAP system")
}

logOutputManager := abaputils.LogOutputManager{
Expand Down
4 changes: 2 additions & 2 deletions cmd/abapEnvironmentPullGitRepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ func handlePull(repo abaputils.Repository, con abaputils.ConnectionDetailsHTTP,

err = api.Pull()
if err != nil {
return errors.Wrapf(err, errorString)
return errors.Wrap(err, errorString)
}

// set correct filename for archive file
logOutputManager.FileNameStep = "pull"
// Polling the status of the repository import on the ABAP Environment system
status, errorPollEntity := abaputils.PollEntity(api, apiManager.GetPollIntervall(), logOutputManager)
if errorPollEntity != nil {
return errors.Wrapf(errorPollEntity, errorString)
return errors.Wrap(errorPollEntity, errorString)
}
if status == "E" {
return errors.New(errorString)
Expand Down
6 changes: 3 additions & 3 deletions cmd/abapEnvironmentPushATCSystemConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func checkATCSystemConfigurationFile(config *abapEnvironmentPushATCSystemConfigO
//check if parsedConfigurationJson is not initial or Configuration Name not supplied
if reflect.DeepEqual(parsedConfigurationJson, emptyConfigurationJson) ||
parsedConfigurationJson.ConfName == "" {
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, errors.Errorf("pushing ATC System Configuration failed. Reason: Configured File does not contain required ATC System Configuration attributes (File: " + config.AtcSystemConfigFilePath + ")")
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, errors.Errorf("pushing ATC System Configuration failed. Reason: Configured File does not contain required ATC System Configuration attributes (File: %s)", config.AtcSystemConfigFilePath)
}

return parsedConfigurationJson, atcSystemConfiguartionJsonFile, nil
Expand All @@ -145,7 +145,7 @@ func readATCSystemConfigurationFile(config *abapEnvironmentPushATCSystemConfigOp
}

if len(filelocation) == 0 {
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, errors.Errorf("pushing ATC System Configuration failed. Reason: Configured Filelocation is empty (File: " + config.AtcSystemConfigFilePath + ")")
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, errors.Errorf("pushing ATC System Configuration failed. Reason: Configured Filelocation is empty (File: %s)", config.AtcSystemConfigFilePath)
}

filename, err = filepath.Abs(filelocation[0])
Expand All @@ -157,7 +157,7 @@ func readATCSystemConfigurationFile(config *abapEnvironmentPushATCSystemConfigOp
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, err
}
if len(atcSystemConfiguartionJsonFile) == 0 {
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, errors.Errorf("pushing ATC System Configuration failed. Reason: Configured File is empty (File: " + config.AtcSystemConfigFilePath + ")")
return parsedConfigurationJson, atcSystemConfiguartionJsonFile, errors.Errorf("pushing ATC System Configuration failed. Reason: Configured File is empty (File: %s)", config.AtcSystemConfigFilePath)
}

err = json.Unmarshal(atcSystemConfiguartionJsonFile, &parsedConfigurationJson)
Expand Down
2 changes: 1 addition & 1 deletion cmd/apiKeyValueMapDownload.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func runApiKeyValueMapDownload(config *apiKeyValueMapDownloadOptions, telemetryD
csvFilePath := config.DownloadPath
file, err := os.Create(csvFilePath)
if err != nil {
return errors.Wrapf(err, "Failed to create api key value map CSV file")
return errors.Wrap(err, "Failed to create api key value map CSV file")
}
_, err = io.Copy(file, downloadResp.Body)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/apiProxyUpload.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func runApiProxyUpload(config *apiProxyUploadOptions, telemetryData *telemetry.C
header.Add("Accept", "application/zip")
fileContent, readError := fileUtils.FileRead(config.FilePath)
if readError != nil {
return errors.Wrapf(readError, "Error reading file")
return errors.Wrap(readError, "Error reading file")
}
if !strings.Contains(config.FilePath, "zip") {
return errors.New("not valid zip archive")
Expand Down
22 changes: 11 additions & 11 deletions cmd/artifactPrepareVersion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func (a *artifactVersioningMock) VersioningScheme() string {

func (a *artifactVersioningMock) GetVersion() (string, error) {
if len(a.getVersionError) > 0 {
return "", fmt.Errorf(a.getVersionError)
return "", fmt.Errorf("%s", a.getVersionError)
}
return a.originalVersion, nil
}

func (a *artifactVersioningMock) SetVersion(version string) error {
if len(a.setVersionError) > 0 {
return fmt.Errorf(a.setVersionError)
return fmt.Errorf("%s", a.setVersionError)
}
a.newVersion = version
return nil
Expand Down Expand Up @@ -92,7 +92,7 @@ func (r *gitRepositoryMock) CommitObject(hash plumbing.Hash) (*object.Commit, er

func (r *gitRepositoryMock) CreateTag(name string, hash plumbing.Hash, opts *git.CreateTagOptions) (*plumbing.Reference, error) {
if len(r.tagError) > 0 {
return nil, fmt.Errorf(r.tagError)
return nil, fmt.Errorf("%s", r.tagError)
}
r.tag = name
r.tagHash = hash
Expand All @@ -102,7 +102,7 @@ func (r *gitRepositoryMock) CreateTag(name string, hash plumbing.Hash, opts *git
func (r *gitRepositoryMock) CreateRemote(config *gitConfig.RemoteConfig) (*git.Remote, error) {
r.createRemoteCalls++
if len(r.createRemoteError) >= r.createRemoteCalls && len(r.createRemoteError[r.createRemoteCalls-1]) > 0 {
return nil, fmt.Errorf(r.createRemoteError[r.createRemoteCalls-1])
return nil, fmt.Errorf("%s", r.createRemoteError[r.createRemoteCalls-1])
}
r.createRemoteConfigs = append(r.createRemoteConfigs, config)
return nil, nil
Expand All @@ -111,15 +111,15 @@ func (r *gitRepositoryMock) CreateRemote(config *gitConfig.RemoteConfig) (*git.R
func (r *gitRepositoryMock) DeleteRemote(name string) error {
r.deleteRemoteCalls++
if len(r.deleteRemoteError) >= r.deleteRemoteCalls && len(r.deleteRemoteError[r.deleteRemoteCalls-1]) > 0 {
return fmt.Errorf(r.deleteRemoteError[r.deleteRemoteCalls-1])
return fmt.Errorf("%s", r.deleteRemoteError[r.deleteRemoteCalls-1])
}
r.deleteRemoteNames = append(r.deleteRemoteNames, name)
return nil
}

func (r *gitRepositoryMock) Push(o *git.PushOptions) error {
if len(r.pushError) > 0 {
return fmt.Errorf(r.pushError)
return fmt.Errorf("%s", r.pushError)
}
r.pushCalled = true
r.pushOptions = o
Expand All @@ -128,22 +128,22 @@ func (r *gitRepositoryMock) Push(o *git.PushOptions) error {

func (r *gitRepositoryMock) Remote(name string) (*git.Remote, error) {
if len(r.remoteError) > 0 {
return &git.Remote{}, fmt.Errorf(r.remoteError)
return &git.Remote{}, fmt.Errorf("%s", r.remoteError)
}
return r.remote, nil
}

func (r *gitRepositoryMock) ResolveRevision(rev plumbing.Revision) (*plumbing.Hash, error) {
if len(r.revisionError) > 0 {
return nil, fmt.Errorf(r.revisionError)
return nil, fmt.Errorf("%s", r.revisionError)
}
r.revision = rev.String()
return &r.revisionHash, nil
}

func (r *gitRepositoryMock) Worktree() (*git.Worktree, error) {
if len(r.worktreeError) > 0 {
return nil, fmt.Errorf(r.worktreeError)
return nil, fmt.Errorf("%s", r.worktreeError)
}
return r.worktree, nil
}
Expand All @@ -159,14 +159,14 @@ type gitWorktreeMock struct {

func (w *gitWorktreeMock) Checkout(opts *git.CheckoutOptions) error {
if len(w.checkoutError) > 0 {
return fmt.Errorf(w.checkoutError)
return fmt.Errorf("%s", w.checkoutError)
}
w.checkoutOpts = opts
return nil
}
func (w *gitWorktreeMock) Commit(msg string, opts *git.CommitOptions) (plumbing.Hash, error) {
if len(w.commitError) > 0 {
return plumbing.Hash{}, fmt.Errorf(w.commitError)
return plumbing.Hash{}, fmt.Errorf("%s", w.commitError)
}
w.commitMsg = msg
w.commitOpts = opts
Expand Down
10 changes: 5 additions & 5 deletions cmd/ascAppUpload.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ func ascAppUpload(config ascAppUploadOptions, telemetryData *telemetry.CustomDat
func runAscAppUpload(config *ascAppUploadOptions, telemetryData *telemetry.CustomData, utils ascAppUploadUtils, ascClient asc.System) error {

if len(config.JamfTargetSystem) == 0 {
return errors.Errorf("jamfTargetSystem must be set")
return errors.New("jamfTargetSystem must be set")
}

log.Entry().Infof("Collect data to create new release in ASC")

app, err := ascClient.GetAppById(config.AppID)
if err != nil {
log.SetErrorCategory(log.ErrorConfiguration)
return errors.Wrapf(err, "failed to get app information")
return errors.Wrap(err, "failed to get app information")
}

log.Entry().Debugf("Found App with name %v", app.AppName)
Expand All @@ -68,7 +68,7 @@ func runAscAppUpload(config *ascAppUploadOptions, telemetryData *telemetry.Custo

if err != nil {
log.SetErrorCategory(log.ErrorService)
return errors.Wrapf(err, "failed to create release")
return errors.Wrap(err, "failed to create release")
}

if releaseResponse.Status != "success" {
Expand All @@ -81,7 +81,7 @@ func runAscAppUpload(config *ascAppUploadOptions, telemetryData *telemetry.Custo
jamfAppInformationResponse, err := ascClient.GetJamfAppInfo(app.BundleId, config.JamfTargetSystem)
if err != nil {
log.SetErrorCategory(log.ErrorService)
return errors.Wrapf(err, "failed to get jamf app info")
return errors.Wrap(err, "failed to get jamf app info")
}

jamfAppId := jamfAppInformationResponse.MobileDeviceApplication.General.Id
Expand All @@ -97,7 +97,7 @@ func runAscAppUpload(config *ascAppUploadOptions, telemetryData *telemetry.Custo
err = ascClient.UploadIpa(config.FilePath, jamfAppId, config.JamfTargetSystem, app.BundleId, releaseResponse.Data)
if err != nil {
log.SetErrorCategory(log.ErrorService)
return errors.Wrapf(err, "failed to upload ipa")
return errors.Wrap(err, "failed to upload ipa")
}

log.Entry().Infof("Successfully uploaded %v to ASC (AppId %v) & Jamf (Id %v)", config.FilePath, app.AppId, jamfAppId)
Expand Down
2 changes: 1 addition & 1 deletion cmd/checkIfStepActive.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func checkIfStepActive(utils piperutils.FileUtils) error {
projectConfig, err := initializeConfig(&pConfig)
if err != nil {
log.Entry().Errorf("Failed to load project config: %v", err)
return errors.Wrapf(err, "Failed to load project config failed")
return errors.Wrap(err, "Failed to load project config failed")
}

stageConfigFile, err := checkStepActiveOptions.openFile(checkStepActiveOptions.stageConfigFile, GeneralConfig.GitHubAccessTokens)
Expand Down
4 changes: 2 additions & 2 deletions cmd/cloudFoundryCreateSpace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestCloudFoundryCreateSpace(t *testing.T) {
s.ShouldFailOnCommand = nil
}()

s.ShouldFailOnCommand = map[string]error{"yes '' | cf login -a https://api.endpoint.com -u testUser -p testPassword ": fmt.Errorf(errorMessage)}
s.ShouldFailOnCommand = map[string]error{"yes '' | cf login -a https://api.endpoint.com -u testUser -p testPassword ": fmt.Errorf("%s", errorMessage)}

e := runCloudFoundryCreateSpace(&config, &telemetryData, cf, &s)
assert.EqualError(t, e, "Error while logging in occured: "+errorMessage)
Expand All @@ -67,7 +67,7 @@ func TestCloudFoundryCreateSpace(t *testing.T) {
defer cfUtilsMock.Cleanup()
errorMessage := "cf space creation error"

m.ShouldFailOnCommand = map[string]error{"cf create-space testSpace -o testOrg": fmt.Errorf(errorMessage)}
m.ShouldFailOnCommand = map[string]error{"cf create-space testSpace -o testOrg": fmt.Errorf("%s", errorMessage)}

cfUtilsMock.LoginError = errors.New(errorMessage)

Expand Down
Loading

0 comments on commit 26e145d

Please sign in to comment.