task: Bash@3
displayName: Generate markdown document
inputs:
targetType: 'inline'
script: |
if [ ! -z "$(commitAndsetVariable.CHANGE_DETECTED)" ]
then
INTRO="Intune backup and documentation generated at $(Build.Repository.Uri) <img align=\"right\" width=\"96\" height=\"96\" src=\"./logo.png\">"
IntuneCD-startdocumentation \
--path="$(Build.SourcesDirectory)/prod-backup" \
--outpath="$(Build.SourcesDirectory)/prod-as-built.md" \
--tenantname=$TENANT_NAME \
--intro="$INTRO" \
--split=Y
else
echo "no configuration backup change detected in the last commit, documentation will not be created"
fi
workingDirectory: '$(Build.SourcesDirectory)'
failOnStderr: true
env:
TENANT_NAME: $(TENANT_NAME)
Describe the bug Failure in Azure Pipeline during markdown document generation stage.
##[error]/home/vsts/work/_temp/03a466b9-ec4f-42a0-a14a-f3fefac2cfc5.sh: line 1: [: prod-backup/Applications/Android/HILANET: binary operator expected
To Reproduce Add Hilanet application to Google Play store and assign it to users. https://play.google.com/store/apps/details?id=il.co.hilanet.HilanetMobile&hl=en&gl=US
Expected behavior Markdown documentation generated correctly for the applications listed.
Screenshots
Run type (please complete the following information):
Additional context
Pipeline details
`# Starter pipeline
Start with a minimal pipeline that you can customize to build and deploy your code.
Add steps that build, run tests, deploy, and more:
https://aka.ms/yaml
trigger: none schedules:
pool: vmImage: ubuntu-latest
jobs:
job: backup_document displayName: Backup Intune configuration pool: vmImage: ubuntu-latest continueOnError: false steps:
Set git global settings
Install IntuneCD
https://github.com/almenscorner/IntuneCD
Backup the latest configuration, using the current directory
Commit changes and push to Azure DevOps repo
date +%Y.%m.%d
git add --allmodified files in folder prod-backup
var=$(git diff --name-only --staged -- prod-backup) echo "##vso[task.setVariable variable=CHANGE_DETECTED;isOutput=true;]$var" git commit -m "Intune config backup $DATEF" git push origin HEAD:main workingDirectory: '$(Build.SourcesDirectory)' failOnStderr: false
Create markdown documentation
Install IntuneCD
https://github.com/almenscorner/IntuneCD
--split=Y
else echo "no configuration backup change detected in the last commit, documentation will not be created" fi workingDirectory: '$(Build.SourcesDirectory)' failOnStderr: true env: TENANT_NAME: $(TENANT_NAME)
Commit changes and push to repo
date +%Y.%m.%d
git add --all git commit -m "Intune config as-built $DATEF" git push origin HEAD:main workingDirectory: '$(Build.SourcesDirectory)' failOnStderr: falsejob: tag displayName: Tag repo dependsOn: backup_document condition: and(succeeded(), ne(dependencies.backup_document.outputs['commitAndsetVariable.CHANGE_DETECTED'], '')) pool: vmImage: ubuntu-latest continueOnError: false steps:
Set git global settings
task: Bash@3 displayName: Configure Git inputs: targetType: 'inline' script: | git config --global user.name $(USER_NAME) git config --global user.email $(USER_EMAIL) workingDirectory: '$(Build.SourcesDirectory)' failOnStderr: true
task: Bash@3 displayName: Pull origin inputs: targetType: 'inline' script: | git pull origin main workingDirectory: '$(Build.SourcesDirectory)' failOnStderr: false
task: PowerShell@2 displayName: Git tag inputs: targetType: 'inline' script: |
change in configuration backup folder detected, create TAG
$DATEF= Get-Date -format "yyyy-MM-dd_THH-mm" git tag -a "v$DATEF" -m "Microsoft Intune configuration snapshot $DATEF" git push origin "v$DATEF" *> $null # even status information goes to stderr :( failOnStderr: true pwsh: false workingDirectory: '$(Build.SourcesDirectory)'
job: publish displayName: Publish as-built artifacts dependsOn: tag condition: and(succeeded(), ne(dependencies.backup_document.outputs['commitAndsetVariable.CHANGE_DETECTED'], '')) pool: vmImage: ubuntu-latest continueOnError: false steps: