Comments (3)
This one is a little more interesting. I don't have a release pipeline or a hosted agent to play around with. I understand the problem in #110 and how that's manifesting here as well where we're grabbing the wrong directory regardeless. I'll take a look at this as well and at the very least use AGENT_RELEASEDIRECTORY instead of SYSTEM_DEFAULTWORKINGDIRECTORY.
Do you think specifying the Path to Set-BuildEnvironment is having impact here, or should have any impact?
from buildhelpers.
So looking at a MS hosted YAML pipeline, I don't have AGENT_RELEASEDIRECTORY in the environment, so that's not a universal directory, but as I said in the other issue that's supposed to be a commit hash not a directory anyway. Also looking at my pipeline, SYSTEM_DEFAULTWORKINGDIRECTORY is D:\a\1\s and I have BUILD_ARTIFACTSTAGINGDIRECTORY, BUILD_STAGINGDIRECTORY, and SYSTEM_ARTIFACTSDIRECTORY, all of which point to D:\a\1\a. So maybe that's a difference between a YAML and a classic pipeline?
So I think what I described in the other issue will take care of Part 1 of your Case 1. Part 2 is a little trickier. I think what's happening isn't that order is being obeyed, but when you pass a collection into a switch statement it checks every item in order. So If you have both SYSTEM_DEFAULTWORKINGDIRECTORY and BUILD_SOURCEVERSIONMESSAGE in environment, what happens is first the switch catches on BUILD_SOURCEVERSIONMESSAGE and properly finds the message, then it catches again on SYSTEM_DEFAULTWORKINGDIRECTORY and since that's bugged it fails.
I may have to reevaluate what I'm doing here because I hadn't though hard enough about it, but using switch like this only works when exactly 1 of the environment variables in the switch statement is in your environment. Using 2 that may be in the environment can make things weird and non-determinant, though i'll have to do some testing in my branch and my test pipeline to verify that behavior.
Certainly it makes me thinks there should be some more tests written to try and catch some of these edge cases as well
from buildhelpers.
Currently, within the Azure DevOps interface, there a two pipelines; 'build' and 'release'.
I am able to use YAML for the 'build' section of the pipeline.
Documentation hints towards the fact that you can also use YAML for release. I however, have no direct interface to create/use a YAML file for the release section of Azure Devops.
Looking at your remarks, the use of YAML and returned environment var's, I tend to assume that you are testing/running things in the 'build' stage/environment of Azure DevOps.
Create a dummy release, request the env: you'll notice that there are other variables populated in the env:
Like AGENT_RELEASEDIRECTORY. Everything with BUILD_ is absend... :)
Looking at the documentation there is a hint that this is 'classic' functionality.
Looking at this, the 'modern way' seems to be (1) using only build and (2) using YAML. Which is (also) covered/solved by current code.
So it is not a mistake; it is on purpose. Using AGENT_RELEASEDIRECTORY makes it unique for release. There is no variable available for the Git hash so we do need that path again... :)
from buildhelpers.
Related Issues (20)
- If you're going to just copy my module into yours .... HOT 1
- Get-BuildVariable: inconsistent PATH parameter usage HOT 11
- Add build checks in Azure Pipelines
- Add support for -Credential <pscredential> in Get-NextNugetPackageVersion and Find-Nugetpackage
- Import-Metadata should be exported
- Strange error when using Set-ModuleFunctions during AppVeyor build HOT 2
- BuildHelpers grabs the wrong variable GitLab CI HOT 1
- Publish a module locally feature request HOT 1
- Get-Buildvariable overwrites CommitMessage on switch default HOT 2
- Include RepoRoot as a BH variable
- Invoke-Git : warning: refname 'x' is ambiguous. HOT 3
- Set-ShieldsIoBadge replaces whole line (until last ')') HOT 1
- Set-BuildEnvironment fails when git is not installed
- Error in Azure Pipeline when Get-ProjectName returns multiple items
- Get-ProjectName fails when alias `git` exists HOT 2
- Return all variables with matching prefix
- Make all environment variables upper-cased?
- Update Set-BuildEnvironment -VariableNamePrefix validation regex HOT 1
- Feature Request: Allow for specifying custom build environment variables
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildhelpers.