Skip to content

Generate sbom for arcade #8424

Merged
37 commits merged intodotnet:mainfrom
epananth:sbom-task
Feb 11, 2022
Merged

Generate sbom for arcade #8424
37 commits merged intodotnet:mainfrom
epananth:sbom-task

Conversation

@epananth
Copy link
Member

@epananth epananth commented Feb 2, 2022

To double check:

Generate sbom for arcade and repos using arcade

  1. Repos using job.yml will not have to make any change on their end. They will just need an arcade update to generate sbom
  2. Repos who do not use job.yml will have to import steps/template/generate-sbom.yml in their pipeline yml

@epananth epananth marked this pull request as ready for review February 2, 2022 23:38
@epananth
Copy link
Member Author

epananth commented Feb 2, 2022

@epananth
Copy link
Member Author

epananth commented Feb 3, 2022

Removed flag enableSbom as we need this in all repos

Sdk test -> https://dev.azure.com/dnceng/internal/_build/results?buildId=1588939&view=logs&j=fa59fe4e-195c-56fa-189b-58fd241f10dd

@epananth epananth requested review from mmitche and riarenas February 3, 2022 04:46
@epananth
Copy link
Member Author

epananth commented Feb 3, 2022

mmitche
mmitche previously approved these changes Feb 4, 2022
@riarenas
Copy link
Contributor

riarenas commented Feb 4, 2022

Could you test this in a repo that has multiple build legs? Both arcade and SDK only have a windows leg.

@epananth
Copy link
Member Author

@epananth
Copy link
Member Author

Copy link
Contributor

@riarenas riarenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments.

Your aspnetcore test failed to generate all linux sboms due to execute permissions for the prep script. Does it still have the execute flag set in git?

EDIT: Also, I'd like us to keep trying to use a common variables template so that we don't have to copy the same defaults in 3 different templates, but if it's proving difficult it's fine as a followup PR.

continueOnError: ${{ parameters.continueOnError }}
condition: and(succeeded(), eq(variables['_DotNetPublishToBlobFeed'], 'true'))

- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why you're using two conditions instead of adding the sbom parameter check to this one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do the same for microbuild, where we have enableMicrobuild in job.yml, so I used the same format... I will move it other condition

- ${{ if eq(parameters.enableSbom, 'true') }}:
- template: /eng/common/templates/steps/generate-sbom.yml
parameters:
PackageVersion : $ {{ parameters.packageVersion}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
PackageVersion : $ {{ parameters.packageVersion}}
PackageVersion : ${{ parameters.packageVersion}}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this

enableSourceIndex: false
sourceIndexParams: {}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] trailing space it looks like?

name: ''
preSteps: []
runAsPublic: false
#Sbom related params
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#Sbom related params
# Sbom related params

Here and everywhere

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a space inbetween the comment and #

name: NetCore1ESPool-Internal
demands: ImageOverride -equals Build.Server.Amd64.VS2019

vmImage: 'windows-2019'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to not check in this testing change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this unwanted code

# ManifestDirPath - The path of the directory where the generated manifest files will be placed

parameters:
PackageVersion: ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is missing for the version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And for the BuildDropPath.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added above params in generete-sbom.yml

sbomContinueOnError: true

steps:
- powershell: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These scripts are still being called as if they were inline. You can take a look at how checked in scripts should be used with the tasks in a bunch of our other templates, such as:

- task: PowerShell@2
displayName: Enable cross-org NuGet feed authentication
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/enable-cross-org-publishing.ps1
arguments: -token $(dn-bot-all-orgs-artifact-feeds-rw)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to use the task instead of inline script

@epananth
Copy link
Member Author

aspnetcore test -> https://dev.azure.com/dnceng/internal/_build/results?buildId=1604274&view=results

Some comments.

Your aspnetcore test failed to generate all linux sboms due to execute permissions for the prep script. Does it still have the execute flag set in git?

EDIT: Also, I'd like us to keep trying to use a common variables template so that we don't have to copy the same defaults in 3 different templates, but if it's proving difficult it's fine as a followup PR.

I added the link, it was late at night and didn't stick around for the entire test. I did add the execute script before I ran it last night. That did not work, so I will have to add chmod back in the script.

I agree I need more time to test that template, I don't want to rush it.

@riarenas
Copy link
Contributor

That did not work, so I will have to add chmod back in the script.

You mentioned you had a test where it had worked?

@riarenas
Copy link
Contributor

I wonder if the Linux failure is related to my other comment of calling the task incorrectly?

@epananth
Copy link
Member Author

I did a test in arcade, unfortunately that does not have a linux leg. So it not work.

@riarenas
Copy link
Contributor

I just checked out this branch: https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore?version=GBsbom

 git ls-files -s eng/common/generate-sbom-prep.sh
100644 d7d132c8d8fd8dfc081c9ea144baf11a621ac0c7 0       eng/common/generate-sbom-prep.sh

So the file is not marked as executable. Make sure to run the command I shared before and commit the file again.

riarenas
riarenas previously approved these changes Feb 10, 2022
Copy link
Contributor

@riarenas riarenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming all tests work I think all I have remaining are nits.
Let's create a followup issue to make the templates source their default values from a common location though.

condition: or(eq(variables['Agent.Os'], 'Windows_NT'), eq(variables['Agent.Os'], 'Darwin'))
inputs:
filePath: ./eng/common/generate-sbom-prep.ps1
arguments: ${{parameters.manifestDirPath}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need to pass -ManifestDirPath first so the script knows which parameter it is? or does this work because there's a single argument to the script?

Co-authored-by: Ricardo Arenas <riarenas@microsoft.com>
@epananth
Copy link
Member Author

this happened :(
image

I def want that approval pls !!!!

@epananth epananth requested a review from riarenas February 10, 2022 23:22
@epananth epananth added the auto-merge Automatically merge PR once CI passes. label Feb 10, 2022
@ghost
Copy link

ghost commented Feb 10, 2022

Hello @epananth!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 78eaf78 into dotnet:main Feb 11, 2022
@mmitche
Copy link
Member

mmitche commented Feb 11, 2022

WOOHOO!

@ericstj
Copy link
Member

ericstj commented Feb 12, 2022

Nice! Trying this out in machinelearning now dotnet/machinelearning#6076.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Automatically merge PR once CI passes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants