Skip to content

Conversation

apoorvdeshmukh
Copy link
Contributor

@apoorvdeshmukh apoorvdeshmukh commented Oct 21, 2022

Resolves #145 and fixes generation of latest tag for all pipeline stages.

parameters:
- name: PushToGithub
default: true
default: false
Copy link
Collaborator

Choose a reason for hiding this comment

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

this has to be true for the automated build to run.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had changed this to false to test the changes. Have reset it to true.

vmImage: 'windows-latest'
variables:
versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['getVersion.VERSION_TAG'] ]
- name: versionTag
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's different about this syntax that makes it work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was just to see if it works. Have added isOutput=true to export the variable.

Copy link
Collaborator

@stuartpa stuartpa left a comment

Choose a reason for hiding this comment

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

:shipit:

@apoorvdeshmukh
Copy link
Contributor Author

@shueybubbles @stuartpa I get permission error User not permitted to queue dry run for build pipeline 500 with modified YAML. Permissions needed: EditBuild when trying to run 'Validate' on the pipeline to test the changes.
Can you grant me the required permission so that I can run 'Validate' with 'PushToGithub' set to false and then merge the changes if no errors seen in pipeline

@shueybubbles
Copy link
Collaborator

    - task: PowerShell@2

just move this task to a new yml file to include as a template in each stage that needs the current tag.


Refers to: build/azure-pipelines/build-product.yml:54 in 5a800fb. [](commit_id = 5a800fb, deletion_comment = False)

@apoorvdeshmukh apoorvdeshmukh marked this pull request as draft November 7, 2022 06:25
@apoorvdeshmukh
Copy link
Contributor Author

    - task: PowerShell@2

just move this task to a new yml file to include as a template in each stage that needs the current tag.

Refers to: build/azure-pipelines/build-product.yml:54 in 5a800fb. [](commit_id = 5a800fb, deletion_comment = False)

I actually had used isOutput instead of isoutput so gave it another shot to see if it works after correcting but it did not.
Have moved the task to a new template. However, pipeline validation started failing as soon as I started using task from template with error that parameter 'ArtifactName' must be provided with value. Have assigned empty value as default to get rid of this error and now the tag is correctly getting populated.
Pipeline was successfully run with changes here

@apoorvdeshmukh apoorvdeshmukh marked this pull request as ready for review November 7, 2022 11:36
@apoorvdeshmukh
Copy link
Contributor Author

For marking the release as 'latest', I don't think any additional changes are needed.
The last release was probably not marked as latest due to missing tags.
As per the docs, if a release is not a 'draft' and not 'pre-release' then by default it is marked as 'latest'.

Write-Host($VERSION_TAG)
- template: build-tag.yml
- script: |
echo $(getVersion.VERSION_TAG)
Copy link
Collaborator

Choose a reason for hiding this comment

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

getVersion.VERSION_TAG)

isn't this just $(VERSION_TAG)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The output variables from task of same job are referred using TaskName.VariableName convention as mentioned here.

@apoorvdeshmukh
Copy link
Contributor Author

@shueybubbles Are the changes okay for merge? Changes are validated with this pipeline run.

versionTag: $[ stageDependencies.Compile.Sqlcmd.outputs['getVersion.VERSION_TAG'] ]
steps:
- template: build-tag.yml
- template: build-common.yml
Copy link
Collaborator

Choose a reason for hiding this comment

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

we don't need to build again, we are downloading the build from the previous stage in the next step

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Had added it mistakenly. Removed in last commit.

@shueybubbles
Copy link
Collaborator

Resolve comments that have been addressed

default:
- name: ArtifactName
type: string
default:
Copy link
Collaborator

Choose a reason for hiding this comment

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

default:

can we revert this now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was intentionally added as a workaround.
In absence of default value, it complains that Parameter 'ArtifactName' must be provided with value. I got this error in 'Validate' but even when ignored and run the pipeline, it still fails with this error.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes but I thought that was because you added that extra include of this template

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right! Will run it again with the reverted change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Validated the changes here. No issues seen.

Copy link
Collaborator

@shueybubbles shueybubbles left a comment

Choose a reason for hiding this comment

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

:shipit:

@apoorvdeshmukh apoorvdeshmukh merged commit f3d651a into main Nov 10, 2022
@shueybubbles shueybubbles deleted the apoorvdeshmukh/145 branch November 10, 2022 21:38
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.

Add a 'latest' release tag

3 participants