Skip to content

Commit

Permalink
New namespace creation in github workflow (Azure#947)
Browse files Browse the repository at this point in the history
* new namespace creation and UI text

* Clarifying namespace tooltip text

---------

Co-authored-by: Reinier Cruz <[email protected]>
  • Loading branch information
ReinierCC and Reinier Cruz authored Sep 30, 2024
1 parent 4ee0eea commit acc5613
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions resources/draft/workflow-helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ env:
CHART_PATH: "your-chart-path"
CHART_OVERRIDE_PATH: "your-chart-override-path"
CHART_OVERRIDES: "your-chart-overrides"
NAMESPACE: 'your-namespace-name'

jobs:
buildImage:
Expand Down Expand Up @@ -103,6 +104,11 @@ jobs:
admin: 'false'
use-kubelogin: 'true'

# Check if namespace exists, if not create it
- name: Ensure Namespace exists
run: |
kubectl get namespace ${{ env.NAMESPACE }} || kubectl create namespace ${{ env.NAMESPACE }}
# Deploys application based on manifest files from previous step
- name: Deploy application
run: HELM_DEPLOY_COMMAND
6 changes: 6 additions & 0 deletions resources/draft/workflow-manifests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ env:
ACR_RESOURCE_GROUP: "your-cluster-resource-group"
CLUSTER_NAME: "your-cluster-name"
DEPLOYMENT_MANIFEST_PATH: 'your-deployment-manifest-path'
NAMESPACE: 'your-namespace-name'

jobs:
buildImage:
Expand Down Expand Up @@ -96,6 +97,11 @@ jobs:
admin: 'false'
use-kubelogin: 'true'

# Check if namespace exists, if not create it
- name: Ensure Namespace exists
run: |
kubectl get namespace ${{ env.NAMESPACE }} || kubectl create namespace ${{ env.NAMESPACE }}
# Deploys application based on given manifest file
- name: Deploys application
uses: Azure/k8s-deploy@v4
Expand Down
1 change: 1 addition & 0 deletions src/commands/draft/baseWorkflowEditor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export abstract class BaseWorkflowEditor<TDeploymentType extends WorkflowDeploym
this.updateEnvVar(envSymbol, "AZURE_CONTAINER_REGISTRY", this.createParams.acrName);
this.updateEnvVar(envSymbol, "CLUSTER_RESOURCE_GROUP", this.createParams.clusterResourceGroup);
this.updateEnvVar(envSymbol, "ACR_RESOURCE_GROUP", this.createParams.acrResourceGroup);
this.updateEnvVar(envSymbol, "NAMESPACE", this.createParams.namespace);
}

/**
Expand Down
6 changes: 6 additions & 0 deletions webview-ui/src/Draft/DraftWorkflow/DraftWorkflow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ export function DraftWorkflow(initialState: InitialState) {
const gitHubRepoTooltipMessage =
"Select the primary/upstream fork of this repository.\n\nThis will allow you to select which branch will trigger the workflow.";

const namespaceTooltipMessage =
"To create a new namespace, write the desired name in the field. If the namespace does not already exist, it will be not be created until the workflow runs.";

return (
<>
<form className={styles.wrapper} onSubmit={handleFormSubmit}>
Expand Down Expand Up @@ -656,6 +659,9 @@ export function DraftWorkflow(initialState: InitialState) {
<>
<label htmlFor="namespace-input" className={styles.label}>
Namespace *
<span className={"tooltip-holder"} data-tooltip-text={namespaceTooltipMessage}>
<i className={`${styles.inlineIcon} codicon codicon-info`} />
</span>
</label>

<TextWithDropdown
Expand Down

0 comments on commit acc5613

Please sign in to comment.