Skip to content

Commit ae1cc97

Browse files
authored
Publish To Environment breaks CI/CD pipelines (#1472)
Fixes #798 If you have an environment, which doesn't have any AUTHCONTEXT it will be ignored during CD (unless you have specifically set ContinuousDeployment to true). Several things can create environments in GitHub (github_pages is an example of this). We cannot determine this during initialization (authcontext could be environment variable), instead you will get a notice: ![image](https://github.com/user-attachments/assets/076a436d-16c8-4ee0-84f3-7059b1d186c6) --------- Co-authored-by: freddydk <[email protected]>
1 parent e3f72c4 commit ae1cc97

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Actions/Deploy/Deploy.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,18 @@ foreach($secretName in "$($envName)-AuthContext","$($envName)_AuthContext","Auth
171171
}
172172
}
173173
if (-not $authContext) {
174+
$msg = "No Authentication Context found for environment ($environmentName). You must create an environment secret called AUTHCONTEXT or a repository secret called $($envName)_AUTHCONTEXT in order to deploy to this environment."
174175
# No AuthContext secret provided, if deviceCode is present, use it - else give an error
175176
if ($env:deviceCode) {
176177
$authContext = "{""deviceCode"":""$($env:deviceCode)""}"
177178
}
179+
elseif ($type -eq 'CD' -and (-not $deploymentSettings.continuousDeployment)) {
180+
# Continuous Deployment is undefined in settings - we will not ignore the environment if no AuthContext is provided
181+
OutputNotice -message $msg
182+
exit
183+
}
178184
else {
179-
throw "No Authentication Context found for environment ($environmentName). You must create an environment secret called AUTHCONTEXT or a repository secret called $($envName)_AUTHCONTEXT."
185+
throw $msg
180186
}
181187
}
182188

RELEASENOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- Issue 1330 CompilerFolder doesn't transfer installed Apps to NuGet resolution
1111
- Issue 1268 Do not throw an un-understandable error during nuGet download
1212
- Performance test sample code in 25.4 contains objects with ID 149201 and 149202, which are not renumbered
13+
- Issue 798 Publish To Environment breaks CI/CD pipelines
1314

1415
### New Workflow specific settings
1516

0 commit comments

Comments
 (0)