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

packaging: align version schema used in packaging #2188

Merged
merged 4 commits into from
Aug 25, 2023

Conversation

reubenmiller
Copy link
Contributor

@reubenmiller reubenmiller commented Aug 24, 2023

Proposed changes

Update version scheme used in packages to align with best practices.

General

  • Use 7 letters to represent the commit hash to align with GitHub's default used in the UI
  • Refactor version scripts to a single version.sh script which is sourced in the relevant scripts

apk

tarball

  • Use version schema x.x.x-rcN+gabcdef0 so that cloudsmith sorts packages built on the main branch correctly

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Improvement (general improvements like code refactoring that doesn't explicitly fix a bug or add any new functionality)
  • Documentation Update (if none of the other choices apply)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Paste Link to the issue


Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA (in all commits with git commit -s)
  • I ran cargo fmt as mentioned in CODING_GUIDELINES
  • I used cargo clippy as mentioned in CODING_GUIDELINES
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

@reubenmiller reubenmiller changed the title align version schema used in packaging packaging: align version schema used in packaging Aug 24, 2023
@reubenmiller reubenmiller added the theme:packaging Theme: Packaging and release artefact topics label Aug 24, 2023
@reubenmiller reubenmiller temporarily deployed to Test Pull Request August 24, 2023 14:03 — with GitHub Actions Inactive
@github-actions
Copy link
Contributor

github-actions bot commented Aug 24, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass % ⏱️ Duration
257 0 5 257 100 53m46.792s

Refactor the scripts to use a version script instead where the env variables can be exported from a central place

Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
@reubenmiller reubenmiller temporarily deployed to Test Pull Request August 25, 2023 01:05 — with GitHub Actions Inactive
Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

This works as explained.

However I have been surprised to see that once the user that a version, than version.sh stick on this version previously set.

$ . ci/build_scripts/version.sh 
$ echo $APK_VERSION '|' $DEB_VERSION '|' $RPM_VERSION '|'  $GIT_SEMVER
0.12.1_rc146+gbdc2ede | 0.12.1~146+gbdc2ede | 0.12.1~146+gbdc2ede | 0.12.1~146+gbdc2ede
$  . ci/build_scripts/version.sh --version 1.0                         
Using version set by user: 1.0
$ echo $APK_VERSION '|' $DEB_VERSION '|' $RPM_VERSION '|'  $GIT_SEMVER
1.0 | 1.0 | 1.0 | 1.0
$ . ci/build_scripts/version.sh                                       
Using version set by user: 1.0
$ echo $APK_VERSION '|' $DEB_VERSION '|' $RPM_VERSION '|'  $GIT_SEMVER
1.0 | 1.0 | 1.0 | 1.0

This is also surprising:

$ . ./ci/build_scripts/version.sh
Using version set by user: 0.12.1~146+gbdc2ede

At least it would be good to tell how to reset the version

$ unset GIT_SEMVER
$ ./ci/build_scripts/version.sh 
0.12.1~146+gbdc2ede

Copy link
Contributor

@didier-wenzek didier-wenzek left a comment

Choose a reason for hiding this comment

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

Approved.

@reubenmiller
Copy link
Contributor Author

This works as explained.

However I have been surprised to see that once the user that a version, than version.sh stick on this version previously set.


$ . ci/build_scripts/version.sh 

$ echo $APK_VERSION '|' $DEB_VERSION '|' $RPM_VERSION '|'  $GIT_SEMVER

0.12.1_rc146+gbdc2ede | 0.12.1~146+gbdc2ede | 0.12.1~146+gbdc2ede | 0.12.1~146+gbdc2ede

$  . ci/build_scripts/version.sh --version 1.0                         

Using version set by user: 1.0

$ echo $APK_VERSION '|' $DEB_VERSION '|' $RPM_VERSION '|'  $GIT_SEMVER

1.0 | 1.0 | 1.0 | 1.0

$ . ci/build_scripts/version.sh                                       

Using version set by user: 1.0

$ echo $APK_VERSION '|' $DEB_VERSION '|' $RPM_VERSION '|'  $GIT_SEMVER

1.0 | 1.0 | 1.0 | 1.0

This is also surprising:


$ . ./ci/build_scripts/version.sh

Using version set by user: 0.12.1~146+gbdc2ede

At least it would be good to tell how to reset the version


$ unset GIT_SEMVER

$ ./ci/build_scripts/version.sh 

0.12.1~146+gbdc2ede

Is the surprising bit the log message? as it gives the wrong impression that it was set by a user (when that is not always true)

@didier-wenzek
Copy link
Contributor

Is the surprising bit the log message? as it gives the wrong impression that it was set by a user (when that is not always true)

The surprising bit is that I was not expecting the version to be cached and furthermore in that case not set by me.

This is really minor.

@reubenmiller
Copy link
Contributor Author

reubenmiller commented Aug 25, 2023

Is the surprising bit the log message? as it gives the wrong impression that it was set by a user (when that is not always true)

The surprising bit is that I was not expecting the version to be cached and furthermore in that case not set by me.

This is really minor.

Ah yes, correct. I guess I've never noticed it as I've sourced the version.sh script from other scripts in an isolated shell so it does not bleed the environment variables into my current shell's environment.

Though if you just want to inspect the versions, then you can call the script (and not source it), e.g.

./ci/build_scripts/version.sh all

output

GIT_SEMVER: 0.12.1~147+gcc43fa8
APK_VERSION: 0.12.1_rc147+gcc43fa8
DEB_VERSION: 0.12.1~147+gcc43fa8
RPM_VERSION: 0.12.1~147+gcc43fa8
TARBALL_VERSION: 0.12.1-rc147+gcc43fa8

Signed-off-by: Reuben Miller <reuben.d.miller@gmail.com>
@reubenmiller reubenmiller temporarily deployed to Test Pull Request August 25, 2023 13:51 — with GitHub Actions Inactive
@reubenmiller reubenmiller merged commit 4048039 into thin-edge:main Aug 25, 2023
16 checks passed
@reubenmiller reubenmiller deleted the fix-package-versioning branch August 25, 2023 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme:packaging Theme: Packaging and release artefact topics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants