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

use awk/sed to replace version #698

Merged
merged 1 commit into from
Oct 28, 2021
Merged

use awk/sed to replace version #698

merged 1 commit into from
Oct 28, 2021

Conversation

jetersen
Copy link
Member

the awk uses exit to match only first occurence and sed expects weekly to only be a major.minor version number.

If those condition are okay to assume this might be simpler than invoking maven.

Since this is running on a github runner, perl or powershell 7 (pwsh) might be a better tool to update the version number.

  • 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

@timja timja added the chore Reduces future maintenance label Oct 28, 2021
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

It's a lot quicker so let's go with it.

@dduportal is fixing the bug in update cli which is making the shell script not work once you add SCM

@jetersen
Copy link
Member Author

jetersen commented Oct 28, 2021

here is a powershell version of it. Much more precise, works on pwsh.

pwsh -f ./updatecli/updatecli.d/weekly-apply.ps1 2.318

$file = "./sample-plugin/pom.xml"

$pomXml = New-Object System.Xml.XmlDocument
$pomXml.PreserveWhitespace = $true
$pomXml.Load($file)
$existingVersion = $pomXml.project.properties.'jenkins.version'
$newVersion = $args[0]

if ($existingVersion -ine $newVersion) {
  $pomXml.project.properties.'jenkins.version' = $newVersion
  $pomXml.Save($file)
}

@timja
Copy link
Member

timja commented Oct 28, 2021

sure go for it

@timja
Copy link
Member

timja commented Oct 28, 2021

The argument './updatecli/updatecli.d/weekly-apply.ps1' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again

@jetersen
Copy link
Member Author

path is correct so maybe it is how updatecli parses arguments

@jetersen
Copy link
Member Author

jetersen commented Oct 28, 2021

Most likely related to the scm thing not setting the correct working directory?

https://github.com/updatecli/updatecli/blob/506e5ebd8e435303a320a749dbc41857e095ae90/pkg/plugins/shell/target.go#L16-L18

@timja
Copy link
Member

timja commented Oct 28, 2021

Most likely related to the scm thing not setting the correct working directory?

updatecli/updatecli@506e5eb/pkg/plugins/shell/target.go#L16-L18

you should be able to test this part locally just fine :)

@jetersen
Copy link
Member Author

jetersen commented Oct 28, 2021

Working directory is off, the folder does not even exist.

ERROR: exec: "C:\\Users\\joseph\\AppData\\Local\\Temp\\updatecli\\jenkinsci\\bom\\updatecli\\updatecli.d\\weekly-apply.ps1": file does not exist

@dduportal
Copy link
Contributor

dduportal commented Oct 28, 2021

to be fair, I never tried using powershell for the shell plugin of updatecli: 99% sure it might not be working correctly 😅

@jetersen
Copy link
Member Author

Well the issue seems to be that the scm part of it is not working ie. checking out the repo before trying to diff/apply

@dduportal
Copy link
Contributor

A fix had been released: https://github.com/updatecli/updatecli/releases/tag/v0.12.0 (tested with the shell version, before this PR).

@timja timja merged commit a390cb2 into jenkinsci:master Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Reduces future maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants