Skip to content

Commit

Permalink
[DC][Sidecars] Remove environment for web app workflow files under ex…
Browse files Browse the repository at this point in the history
…perimentation and remove environment + experimentation for function app workflow files (#7893)

Co-authored-by: Yoona Oh <[email protected]>
  • Loading branch information
yoonaoh and johmsft authored Nov 4, 2024
1 parent a7f2390 commit 8e32771
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const DeploymentCenterCodeForm: React.FC<DeploymentCenterCodeFormProps> = props
const { t } = useTranslation();
const [isRedeployConfirmDialogVisible, setIsRedeployConfirmDialogVisible] = useState(false);
const [isDiscardConfirmDialogVisible, setIsDiscardConfirmDialogVisible] = useState(false);
const [isRemoveEnvEnabled, setIsRemoveEnvEnabled] = useState(false);
const [isRemoveEnvWebAppEnabled, setIsRemoveEnvWebAppEnabled] = useState(false);

const siteStateContext = useContext(SiteStateContext);
const portalContext = useContext(PortalContext);
Expand All @@ -70,9 +70,9 @@ const DeploymentCenterCodeForm: React.FC<DeploymentCenterCodeFormProps> = props
useEffect(() => {
let isSubscribed = true;

portalContext?.getBooleanFlight(ExperimentationConstants.FlightVariable.removeDeployEnvironment).then(hasFlightEnabled => {
portalContext?.getBooleanFlight(ExperimentationConstants.FlightVariable.removeDeployEnvironmentWebApp).then(hasFlightEnabled => {
if (isSubscribed) {
setIsRemoveEnvEnabled(hasFlightEnabled);
setIsRemoveEnvWebAppEnabled(hasFlightEnabled);
}
});

Expand Down Expand Up @@ -130,20 +130,16 @@ const DeploymentCenterCodeForm: React.FC<DeploymentCenterCodeFormProps> = props
}

if (listFederatedCredentialsResponse.metadata.success) {
// NOTE(yoonaoh): For Function Apps that are not node or python, the workflow file does not define
// an environment in the build and deploy step, so we need to use the branch as the subject.
// This is a workaround until we update the workflow files to define environments for all the stacks.
// NOTE(yoonaoh): Web Apps define an environment in the workflow file, so we need to
// continue using the environment reference as the subject. Eventually, we will
// remove the environment entirely, so that we only need to use the branch reference.
let subject = '';
if (isRemoveEnvEnabled) {
if (isRemoveEnvWebAppEnabled) {
subject = `repo:${values.org}/${values.repo}:ref:refs/heads/${values.branch}`;
} else {
subject = siteStateContext.isFunctionApp
? `repo:${values.org}/${values.repo}:ref:refs/heads/${values.branch}`
: `repo:${values.org}/${values.repo}:environment:${armSiteId.slot ?? CommonConstants.Production}`;
} else {
subject =
siteStateContext.isFunctionApp &&
!(values.runtimeStack === RuntimeStacks.node || values.runtimeStack === RuntimeStacks.python)
? `repo:${values.org}/${values.repo}:ref:refs/heads/${values.branch}`
: `repo:${values.org}/${values.repo}:environment:${armSiteId.slot ?? CommonConstants.Production}`;
}
const issuerSubjectAlreadyExists = deploymentCenterData.issuerSubjectAlreadyExists(
subject,
Expand Down Expand Up @@ -393,7 +389,7 @@ const DeploymentCenterCodeForm: React.FC<DeploymentCenterCodeFormProps> = props
variables['tenantId'] = values.authIdentity.properties.tenantId;
}

if (isRemoveEnvEnabled) {
if (isRemoveEnvWebAppEnabled) {
variables['isRemoveEnvEnabled'] = true;
}

Expand Down
1 change: 1 addition & 0 deletions client-react/src/utils/CommonConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ export class ExperimentationConstants {

public static FlightVariable = {
removeDeployEnvironment: 'remove-deploy-environment',
removeDeployEnvironmentWebApp: 'remove-deploy-environment-webapp',
enableSidecarMigration: 'enable-sidecar-migration',
showDCReactView: 'show-dc-reactview',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ jobs:
deploy:
runs-on: windows-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ jobs:
deploy:
runs-on: windows-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
deploy:
runs-on: windows-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
deploy:
runs-on: windows-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: '__slotname__'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
__environment__
__permissions__
steps:
- name: Download artifact from build job
Expand Down

0 comments on commit 8e32771

Please sign in to comment.