Is there a simple dotnet buildspec file example (OD-2166)
Brent Hitzeroth opened 1 year ago

I am looking for a example buildspec file for dotnet build as I keep getting can't find specified file errors. It would be especially helpful to understand how to reference project and solution files to be built.

  • Robin Shen commented 1 year ago

    An example build spec calling dotnet to run test. It

    version: 25
    jobs:
    - name: CI
      steps:
      - !CheckoutStep
        name: checkout
        cloneCredential: !DefaultCredential {}
        withLfs: false
        withSubmodules: false
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      - !CommandStep
        name: build
        runInContainer: true
        image: mcr.microsoft.com/dotnet/sdk:7.0
        interpreter: !DefaultInterpreter
          commands:
          - dotnet test -l trx
        useTTY: false
        condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
      retryCondition: never
      maxRetries: 3
      retryDelay: 30
      timeout: 3600
    
  • Brent Hitzeroth commented 1 year ago

    Thank you I have it working using Powershell. One thing I am struggling with is how to zip artifacts when I want to include all subfolders, it works fine with a one level project but I don't know what syntax to use with sub folders as a result all my tries result in no artifacts generated. just for info I am building a dot net 8 blazor application.

  • Robin Shen commented 1 year ago

    Say if you want to publish all files as artifacts under folder "package" under job workspace, you may specify artifacts of the publish artifact step as "package/**".

    OneDev uses Ant style wildcard matching for paths. For details, please check: https://docs.onedev.io/appendix/path-wildcard

  • Brent Hitzeroth commented 1 year ago

    Yes I get that far but how do I add all the folders and files to a single zip file? It works with single level by using "*.zip" but I can't seem to get it working when using folders, "bin/**.zip" does not work?

  • Robin Shen commented 1 year ago

    The artifact publish step just publish files as is. You may zip files with a separate command step before running artifact publish step.

  • Robin Shen changed state to 'Closed' 1 year ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Question
Priority
Major
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2166
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover