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

automatically generate version suffixes #2709

Merged
merged 5 commits into from
Jan 9, 2024

Conversation

davidmrdavid
Copy link
Contributor

@davidmrdavid davidmrdavid commented Jan 5, 2024

Replaces: #2707

When making a private extension release, we manually add a version suffix to the package so that it can be distinguished from an official release.

This PR automates that process in 2 ways:

(1) the CI automatically adds a version suffix when the standard/manual release pipeline is triggered in a feature branch. The version suffix will be -pr.<yyyymmdd.<buildRev>> where <buildRev> is an integer that increases every time the pipeline is triggered on a given day.
(2) the CI automatically adds a version suffix when the nightly release pipeline is triggered. The version suffix will be -ci.<yyyymmdd.<buildRev>> where <buildRev> is an integer that increases every time the pipeline is triggered on a given day.

@davidmrdavid davidmrdavid force-pushed the dajusto/add-automatic-version-suffix branch from 1123fd1 to d16f78a Compare January 5, 2024 19:45
@davidmrdavid davidmrdavid requested review from jviau and bachuv January 5, 2024 20:48
azure-pipelines-release.yml Outdated Show resolved Hide resolved
@davidmrdavid davidmrdavid requested a review from jviau January 5, 2024 22:30
variables:

- name: PackageSuffix
${{ if ne(variables['Build.SourceBranchName'], 'dev') }}:
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest checking $(Build.Reason) instead of source branch:

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

Can differentiate PR and CI this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into $(Build.Reason), good idea.
Though I just realized I made a mistake here - The nightly build should probably only build from dev anyways. So I should change to logic here so this is always a ci build.

- name: PackageSuffix
# if source branch is not `dev` then we're generating a release based on a feature branch
# In that case, we populate the environment variable "PackageSuffix" accordingly
${{ if ne(variables['Build.SourceBranchName'], 'dev') }}:
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, can check Build.Reason.

Release build can be manual queue and dev branch.

And does this build def get ran post merge? In which case that would be a ci build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Today, this pipeline only runs when manually triggered, so it does not run automatically post-merge. The nightly pipeline does run post-merge, but that's a different .yml.

In this case, since this pipeline is always manual - do you think still think it makes sense to check Build.Reason? In my mind, the Build.Reason for this pipeline is always: "Manual".

Copy link
Contributor

@jviau jviau Jan 8, 2024

Choose a reason for hiding this comment

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

If we you do the build reason calculation, that is a step towards getting rid of the separate nightly pipeline and using this one for that as well.

Also, this is used for PRs as well is it not? Build.Reason will show PR then.

Copy link
Contributor

@jviau jviau left a comment

Choose a reason for hiding this comment

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

Approved. I wouldn't mind seeing some investment towards consolidating the CI files and pipelines, but that can be done later.

@davidmrdavid
Copy link
Contributor Author

Thanks @jviau - I agree it would be good to consolidate (and I agree it would be a good idea), but +1 to doing it later so we can benefit from the automation now. Thanks!

@davidmrdavid davidmrdavid merged commit 5d0219d into dev Jan 9, 2024
20 checks passed
@davidmrdavid davidmrdavid deleted the dajusto/add-automatic-version-suffix branch January 9, 2024 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants