0
votes

I'm new to Azure DevOps and pipelines, and I ran into an issue running the same pipeline multiple times in a short period.

In brief, I created a pipeline to simply build a .Net project with MSBuild and generate an artifact. The pipeline trigger on change in master branch.

The first time, it worked, I can download the artifact and execute the program without any issue. Now if I do a change in the master branch 5 minutes later adding an option to my program, the pipeline runs successfully, however when running program stored in the generated artifact, my new option is not there.

I'm probably doing something stupid there, but I don't understand why I have this behaviour.

Is there any kind of caching and how can I have fresh build everytime ?

== EDIT ==

Here is my YAML definition as requested

Basically, steps are:

  1. Checkout solution with all submodule
  2. Nuget restore packages for all required projects
  3. MSBuild task
  4. Archive the output
  5. Publish artifact.
trigger:
- master

pool:
  demands: azureps
  vmImage: 'windows-latest'

steps:
- checkout: "git://GSS-CMDB-Tools/GSSAM_Code"
  submodules: true
  persistCredentials: true

- task: NuGetCommand@2
  inputs:
    command: 'custom'
    arguments: 'restore ADDMSync/packages.config -SolutionDirectory .'

- task: NuGetCommand@2
  inputs:
    command: 'custom'
    arguments: 'restore GSSAM/packages.config -SolutionDirectory .'

- task: NuGetCommand@2
  inputs:
    command: 'custom'
    arguments: 'restore GSSAM.ADDMRest/packages.config -SolutionDirectory .'

- task: NuGetCommand@2
  inputs:
    command: 'custom'
    arguments: 'restore GSSAM.SNOWRest/packages.config -SolutionDirectory .'

- task: MSBuild@1
  inputs:
    solution: 'ADDMSync/ADDMSync.csproj'
    msbuildArchitecture: 'x64'
    configuration: 'Release'
    msbuildArguments: '/p:PostBuildEvent='

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      # Write your PowerShell commands here.

      mv ADDMSync/bin/Release ADDMSync/Bin/ADDMSync
      rm ADDMSync/bin/ADDMSync/*.pdb

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: 'ADDMSync/bin/ADDMSync'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/ADDMSync.zip'
    replaceExistingArchive: true

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)/ADDMSync.zip'
    ArtifactName: 'ADDMSync'
    publishLocation: 'Container'

Thanks a lot

Rémi

1
For sure this is not caused by cache. When a new agent is assigned to a request you will get already cleaned version. It can be different with self hosted agent. But this is not your case right? Can you add your YAML definition?Krzysztof Madej

1 Answers

0
votes

OK I think I understand what happens.

What I did was to commit and push all submodules required by the build. However I did not commit the modification of the solution itself. By doing so it makes it working.

I don't understand why for now, I guess it's link to the way the checkout task works.