Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run on our infrastructure #1933

Merged
merged 8 commits into from
Jun 21, 2024
Merged

Run on our infrastructure #1933

merged 8 commits into from
Jun 21, 2024

Conversation

sebastien-marichal
Copy link
Contributor

@sebastien-marichal sebastien-marichal commented Jun 10, 2024

Fixes #1934


I have done some tests and was able to have a green CI for the Build stage.
To do so, I had to disable/comment on any task related to the SBOM file:

  • Dotnet generate SBOM task
  • Generate packages task: I commented two lines in the script
  • Stage to repox task which needs the file to continue

Once the build of the dotnet-ci AMI is working, I do not expect to see any other issues, except maybe in the Stage to repox.

Update (from Zsolt): I re-enabled the tasks and modified the SBOM generation to make it work with the new image.

@sebastien-marichal sebastien-marichal changed the title SCAN4NET-7 Run on our infrastructure Run on our infrastructure Jun 10, 2024
@sebastien-marichal sebastien-marichal marked this pull request as draft June 13, 2024 14:41
@sebastien-marichal sebastien-marichal marked this pull request as draft June 13, 2024 14:41
@sebastien-marichal sebastien-marichal force-pushed the sma/scan4net-7 branch 3 times, most recently from c64f4c9 to 845aae5 Compare June 14, 2024 13:36
Comment on lines 202 to 190
- powershell: |
nuget help | Select-String "NuGet Version"
nuget pack 'nuspec\netcoreglobaltool\dotnet-sonarscanner.nuspec' -NonInteractive -OutputDirectory build -Verbosity Detailed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NuGetCommand@2 uses an older version of nuget.exe

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource force-pushed the sma/scan4net-7 branch 2 times, most recently from f86d098 to 004e31f Compare June 20, 2024 10:19
Copy link
Contributor

@Tim-Pohlmann Tim-Pohlmann left a comment

Choose a reason for hiding this comment

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

I need to understand the PR more to review it properly. I mainly submitted questions.

azure-pipelines.yml Show resolved Hide resolved
azure-pipelines.yml Outdated Show resolved Hide resolved
azure-pipelines.yml Outdated Show resolved Hide resolved
azure-pipelines.yml Show resolved Hide resolved
azure-pipelines.yml Show resolved Hide resolved
azure-pipelines.yml Outdated Show resolved Hide resolved
azure-pipelines.yml Show resolved Hide resolved
Copy link
Contributor

@Tim-Pohlmann Tim-Pohlmann left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

sonarcloud bot commented Jun 21, 2024

@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource marked this pull request as ready for review June 21, 2024 09:59
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource merged commit 8377912 into master Jun 21, 2024
14 checks passed
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource deleted the sma/scan4net-7 branch June 21, 2024 10:00
Comment on lines 72 to +75
- task: NuGetToolInstaller@1
displayName: "Install NuGet"
inputs:
versionSpec: $(NUGET_VERSION)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it runs on our infrastructure, we don't need to install NuGet.
Why is this needed?
I remembered, I removed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems the Nuget installed on the CI image doesn't work, the Package dotnet global tool task fails:

NuGet Version: 4.9.6.8
Attempting to build package from 'dotnet-sonarscanner.nuspec'.
System.InvalidOperationException: The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd' has invalid child element 'readme' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd'. List of possible elements expected: 'serviceable, dependencies, repository, licenseUrl, copyright, references, packageTypes, contentFiles, releaseNotes, tags, language, developmentDependency, frameworkAssemblies, owners' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd'. This validation error occurred in a 'readme' element.
   at NuGet.Packaging.Manifest.<>c.<ValidateManifestSchema>b__20_0(Object sender, ValidationEventArgs e)
   at System.Xml.Schema.XmlSchemaValidator.ValidateElementContext(XmlQualifiedName elementName, Boolean& invalidElementInContext)
   at System.Xml.Schema.XmlSchemaValidator.ValidateElement(String localName, String namespaceUri, XmlSchemaInfo schemaInfo, String xsiType, String xsiNil, String xsiSchemaLocation, String xsiNoNamespaceSchemaLocation)
   at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e)
   at System.Xml.Schema.XNodeValidator.ValidateNodes(XElement e)
   at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e)
   at System.Xml.Schema.XNodeValidator.ValidateNodes(XElement e)
   at System.Xml.Schema.XNodeValidator.ValidateElement(XElement e)
   at System.Xml.Schema.XNodeValidator.Validate(XObject source, XmlSchemaObject partialValidationType, Boolean addSchemaInfo)
   at NuGet.Packaging.Manifest.ValidateManifestSchema(XDocument document, String schemaNamespace)
   at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
   at NuGet.Packaging.PackageBuilder.ReadManifest(Stream stream, String basePath, Func`2 propertyProvider)
   at NuGet.Packaging.PackageBuilder..ctor(String path, String basePath, Func`2 propertyProvider, Boolean includeEmptyDirectories)
   at NuGet.Commands.PackCommandRunner.CreatePackageBuilderFromNuspec(String path)
   at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)
   at NuGet.Commands.PackCommandRunner.BuildPackage()
   at NuGet.CommandLine.PackCommand.ExecuteCommand()
   at NuGet.CommandLine.Command.ExecuteCommandAsync()
   at NuGet.CommandLine.Command.Execute()
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
##[error]The nuget command failed with exit code(1) and error(The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd' has invalid child element 'readme' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd'. List of possible elements expected: 'serviceable, dependencies, repository, licenseUrl, copyright, references, packageTypes, contentFiles, releaseNotes, tags, language, developmentDependency, frameworkAssemblies, owners' in namespace 'http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd'. This validation error occurred in a 'readme' element.)
##[error]An error occurred while trying to pack the files.

We'll have to update the Nuget version on the image first before we can remove the Nuget installer task.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's why I made this change: 71fb1b3

The NuGetCommand@2 task does not seem to use the NuGet we installed.
I didn't check if there is a way to tell to use the one we use.

@@ -430,6 +455,10 @@ stages:
targetPath: '$(Build.SourcesDirectory)\build'
artifactName: build

- task: NuGetToolInstaller@1
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why this has been added?
It was not required.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run on our infrastructure
4 participants