0

I am using an azure pipeline to automatically update pdf documentation within a repository. I can do this using sphinx and a makefile together with .rst files that can be tracked with git. I wanted to have a windows pipeline such that the same commands can be used if users want to run the makefile on their local computer. Therefore I have the following azure_pipeline.yml:

# Trigger the pipeline pull requests in master (commits are not allowed in master)
# In Azure devops this should be added using a 'build validation policy'. This trigger can not be done in this yaml
trigger:
- master

pool:
  vmImage: 'windows-latest'

# Define here which python version will be used
strategy:
  matrix:
    Python39:
      python.version: '3.9'

# Use python version defined before
steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '$(python.version)'
  displayName: 'Use Python $(python.version)'

# Install sphinx dependencies, use pep517 to get sklearn to work 
- script: |
    python -m pip install -r sphinx_requirements.txt
  displayName: 'Install sphinx dependencies'

# Install make to create the sphinx documentation, this way the pipeline can be used similar as locally using the 'make pdf' call in build.cmd
- script: |
    choco feature enable -n allowGlobalConfirmation
    echo Install Make
    choco install -y make
    refreshenv
  workingDirectory: docs/
  displayName: 'Install make'

# Install texlive, which is a free distribution of the TeX typesetting system
# Install the basic version with all the packages we used in the documentation that is not already included in the basic scheme
- script: |
    choco install -y texlive --params="'/InstallationPath:C:\ProgramData\chocolatey\lib\texlive /scheme:basic /extraPackages:cmap,fncychap,transparent,eso-pic,lipsum,footnotebackref,setspace,datetime,etoolbox,xcolor,sectsty,enumitem,epigraph,float,wrapfig,capt-of,framed,upquote,needspace,parskip,tabulary,varwidth,fancyvrb,titlesec,fmtcount,xkeyval,nextpage'"
    refreshenv
  displayName: 'Install texlive'

# Create the sphinx documentation with miktex that is just downloaded
# Note, that if we are using miktex instead of texlive, we need to set the PATH, just to be sure we will always set it, if we are using texlive, it will just continue
- script: |
    echo Create pdf
    make pdf
  workingDirectory: docs/
  displayName: 'Create sphinx documentation'

# Copy pdf file from 
- task: CopyFiles@2
  displayName: 'Copy pdf file'
  inputs:
    SourceFolder: '$(Pipeline.Workspace)'
    Contents: '**/Palantir.pdf'
    TargetFolder: '$(Build.ArtifactStagingDirectory)'
    flattenFolders: true

# Publish file to a build artifact
- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: pdf'
  inputs:
    ArtifactName: Documentation with release notes

Above was always working. However, I got now the following error in 'Install texlive':

ERROR: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: TeX Live 2022 is frozen
  texlive may be able to be automatically uninstalled.

I don't completely understand this error, what should I change to have a working azure pipeline?

PS: I have already tried MikTex instead of Texlive. But I was not able to get that to work.

barryhunter
  • 20,886
  • 3
  • 30
  • 43

1 Answers1

0

I tried the below YAML script and the Tex live package was installed and the pipeline to copy task with publish artifact ran successfully, Refer below:-

YAML Script:-

# 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 the pipeline pull requests in master (commits are not allowed in master)

# In Azure devops this should be added using a 'build validation policy'. This trigger can not be done in this yaml

trigger:

- master

  

pool:

vmImage: 'windows-latest'

  

# Define here which python version will be used

strategy:

matrix:

Python39:

python.version: '3.9'

  

# Use python version defined before

steps:

- task: UsePythonVersion@0

inputs:

versionSpec: '$(python.version)'

displayName: 'Use Python $(python.version)'

  

- script: |

python -m pip install -r $(Build.SourcesDirectory)\sphinx_requirements.txt

displayName: 'Install sphinx dependencies'

  
  

# Install make to create the sphinx documentation, this way the pipeline can be used similar as locally using the 'make pdf' call in build.cmd

- script: |

- script: |

choco install -y texlive --params="'/InstallationPath:$(Build.SourcesDirectory)\texlive /scheme:basic /extraPackages:cmap,fncychap,transparent,eso-pic,lipsum,footnotebackref,setspace,datetime,etoolbox,xcolor,sectsty,enumitem,epigraph,float,wrapfig,capt-of,framed,upquote,needspace,parskip,tabulary,varwidth,fancyvrb,titlesec,fmtcount,xkeyval,nextpage'"

refreshenv

displayName: 'Install texlive'

workingDirectory: $(Build.SourcesDirectory)

  

# Copy pdf file from

- task: CopyFiles@2

displayName: 'Copy pdf file'

inputs:

SourceFolder: '$(Build.SourcesDirectory)'

Contents: '**/Palantir.pdf'

TargetFolder: '$(Build.ArtifactStagingDirectory)'

flattenFolders: true

  

# Publish file to a build artifact

- task: PublishBuildArtifacts@1

inputs:

PathtoPublish: '$(Build.SourcesDirectory)'

ArtifactName: 'Documentation with release notes'

Output:-

enter image description here

enter image description here

Published Artifact:-

enter image description here

Reference:-

azure-docs/add-template-to-azure-pipelines.md at main · MicrosoftDocs/azure-docs · GitHub

SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11