-
Notifications
You must be signed in to change notification settings - Fork 251
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document enhancement features (#741)
Co-authored-by: Anthony Watherston <[email protected]>
- Loading branch information
Showing
11 changed files
with
356 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,8 @@ function Out-DocumentationForPolicyAssignments { | |
$DocumentationSpecification, | ||
[hashtable] $AssignmentsByEnvironment, | ||
[switch] $IncludeManualPolicies, | ||
[hashtable] $PacEnvironments | ||
[hashtable] $PacEnvironments, | ||
[string] $WikiClonePat | ||
) | ||
|
||
[string] $fileNameStem = $DocumentationSpecification.fileNameStem | ||
|
@@ -587,5 +588,46 @@ function Out-DocumentationForPolicyAssignments { | |
} | ||
|
||
#endregion csv | ||
|
||
|
||
#region PushToWiki | ||
if ($DocumentationSpecification.markdownAdoWikiConfig) { | ||
if ($WikiClonePat -eq "") { | ||
Write-Error "PAT Token not found! Please pass as parameter 'WikiClonePat'!" | ||
Exit 1 | ||
} | ||
Write-Information "Attempting push to Azure DevOps Wiki" | ||
# Clone down wiki | ||
git clone "https://$($WikiClonePat):x-oauth-basic@$($DocumentationSpecification.markdownAdoWikiConfig.adoOrganization).visualstudio.com/$($DocumentationSpecification.markdownAdoWikiConfig.adoProject)/_git/$($DocumentationSpecification.markdownAdoWikiConfig.adoWiki).wiki" | ||
# Move into folder | ||
Set-Location -Path "$($DocumentationSpecification.markdownAdoWikiConfig.adoWiki).wiki" | ||
$branch = git branch | ||
$branch = $branch.split(" ")[1] | ||
# Copy main markdown file into wiki | ||
Copy-Item -Path "../$OutputPath/$($DocumentationSpecification.fileNameStem).md" | ||
# Configure dummy email and user (required) | ||
git config user.email "[email protected]" | ||
git config user.name "EPAC Wiki" | ||
# Add changes to commit | ||
git add . | ||
# Check if a folder exist that holds the sub pages | ||
if (-not (Test-Path -Path "$($DocumentationSpecification.fileNameStem)")) { | ||
# Create folder if does not exist | ||
New-Item -Path "$($DocumentationSpecification.fileNameStem)" -ItemType Directory | ||
} | ||
# Copy all individual services markdown files | ||
$services = Get-ChildItem -Path "../$OutputPathServices" | ||
# Move into folder | ||
Set-Location -Path "$($DocumentationSpecification.fileNameStem)" | ||
# Remove files that currently exist in file to ensure fresh updates | ||
Get-ChildItem -Path . -File | Remove-Item | ||
# Copy over new individual services markdown files | ||
foreach ($file in $services) { | ||
Copy-Item $file . | ||
} | ||
# Commit and push up to Wiki | ||
git add . | ||
git commit -m "Update wiki with the latest markdown files" | ||
git push origin "$branch" | ||
Set-Location "../../" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
StarterKit/Pipelines/AzureDevOps/GitHub-Flow-With-AdoWiki/epac-dev-pipeline-with-adowiki.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
variables: | ||
# This pipeline is used to deploy Policies, Initiative definitions and Assignments into Azure. | ||
PAC_OUTPUT_FOLDER: ./Output | ||
PAC_DEFINITIONS_FOLDER: ./Definitions | ||
|
||
# Use the plain text name of each service connection as a reference | ||
planServiceConnection: "sc-epac-plan" | ||
devServiceConnection: "sc-epac-dev" | ||
|
||
# set the environment selector | ||
pacEnvironmentSelector: epac-dev | ||
|
||
# what to build trigger | ||
trigger: | ||
branches: | ||
include: | ||
- feature/* | ||
paths: | ||
include: | ||
- Definitions | ||
- Pipelines | ||
|
||
pr: none | ||
|
||
pool: | ||
vmImage: "ubuntu-latest" | ||
|
||
stages: | ||
- stage: Plan | ||
displayName: "Plan ${{ variables.pacEnvironmentSelector }}" | ||
jobs: | ||
- job: Plan | ||
steps: | ||
- template: templates/plan.yml | ||
parameters: | ||
serviceConnection: $(planServiceConnection) | ||
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }} | ||
|
||
- stage: Deploy | ||
displayName: "Deploy ${{ variables.pacEnvironmentSelector }}" | ||
dependsOn: Plan | ||
condition: and(not(failed()), not(canceled()), or(eq(dependencies.Plan.outputs['Plan.Plan.deployPolicyChanges'], 'yes'), eq(dependencies.Plan.outputs['Plan.Plan.deployRoleChanges'], 'yes'))) | ||
variables: | ||
PAC_INPUT_FOLDER: "$(Pipeline.Workspace)/plans-${{ variables.pacEnvironmentSelector }}" | ||
localDeployPolicyChanges: $[stageDependencies.Plan.Plan.outputs['Plan.deployPolicyChanges']] | ||
localDeployRoleChanges: $[stageDependencies.Plan.Plan.outputs['Plan.deployRoleChanges']] | ||
jobs: | ||
- deployment: DeployPolicy | ||
displayName: "Deploy Policy Changes" | ||
environment: PAC-DEV | ||
condition: and(not(failed()), not(canceled()), eq(variables.localDeployPolicyChanges, 'yes')) | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- template: templates/deploy-policy.yml | ||
parameters: | ||
serviceConnection: $(devServiceConnection) | ||
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }} | ||
- deployment: DeployRoles | ||
displayName: "Deploy Role Changes" | ||
dependsOn: DeployPolicy | ||
environment: PAC-DEV | ||
condition: and(not(failed()), not(canceled()), eq(variables.localDeployRoleChanges, 'yes')) | ||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- template: templates/deploy-roles.yml | ||
parameters: | ||
serviceConnection: $(devServiceConnection) | ||
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }} | ||
|
||
- stage: tenantPlan | ||
displayName: "Plan tenant" | ||
dependsOn: | ||
- Deploy | ||
condition: and(not(failed()), not(canceled())) | ||
jobs: | ||
- job: Plan | ||
steps: | ||
- template: templates/plan.yml | ||
parameters: | ||
serviceConnection: $(planServiceConnection) | ||
pacEnvironmentSelector: tenant | ||
|
||
- stage: Documentation | ||
displayName: "Document ${{ variables.pacEnvironmentSelector }}" | ||
condition: always() | ||
jobs: | ||
- job: Documentation | ||
displayName: "Create Documentation" | ||
steps: | ||
- template: templates/documentation.yaml | ||
parameters: | ||
serviceConnection: $(serviceConnectionPlan) | ||
pacEnvironmentSelector: ${{ variables.pacEnvironmentSelector }} |
Oops, something went wrong.