Skip to content

Add options for pre-commands and environment variables to lambda package command #329

@mark-hopper

Description

@mark-hopper

Describe the feature

Add an option which will allow you to specify a set of commands to be pre-pended prior to the dotnet publish command when using package. Additionally it would be really useful to be able to specify additional environment variables sent to the docker container that is ran.

Use Case

When using a private NuGet feed, we need to make use of appropriate PAT tokens or credentials. In our specific use case we'd like to use the Azure Artifacts Credential Provider, but this requires some installation and setup prior to the dotnet publish command.

In the case of the installation, I'm aware we can go ahead take the base image, add what additional tools we need, and then use the -cifb switch to specify the appropriate container. But this is only part of the problem, in order to use the credentials provider we need to specify additional environment variables namely VSS_NUGET_EXTERNAL_FEED_ENDPOINTS which currently as far as I can see the CLI does not support us providing as part of the build.

For context the above is in reference to a .NET 8 AOT Native build.

The only workaround that I can see currently, is to specify the credentials in plaintext in the Nuget.Config file at the root of the project prior to running the dotnet lambda package command, which is not ideal.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Targeted .NET platform

8.0.303

CLI extension version

5.10.7

Environment details (OS name and version, etc.)

MacOS Sonoma 14.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions