[在buildspec.yml中指定GitHub的软件包存储库

问题描述 投票:0回答:1

每当我将代码检入GitHub存储库的master分支时,我就会启动一个AWS CodeBuild流程。我的代码库是一个dotnet核心无服务器应用程序。我对驻留在GitHub软件包存储库中的私有nuget软件包有依赖性。尝试查找软件包时,我的CodeBuild过程失败:

error NU1101: Unable to find package datastop.io.data-dictionary. 
No packages exist with this id in source(s): nuget.org 

datastop.io.data-dictionary是一个私有nuget包,位于GitHub软件包存储库中,而不是nuget.org中。错误消息表明CodeBuild进程正在尝试在nuget中查找“ datastop.io.data-dictionary”。

这是我当前的buildspec.yml文件:

version: 0.2
phases:
    install:
        runtime-versions:
            dotnet: 2.1
        commands:
            - echo Entered the install phase...
            - export PATH="$PATH:/root/.dotnet/tools"
            - dotnet tool install -g Amazon.Lambda.Tools
    pre_build:
        commands:
            - echo Entered the pre_build phase...
            - dotnet restore
    build:
        commands:
            - echo Entered the build phase...
            - echo Build started on `date`
            - cd $FOLDER
            - dotnet lambda package --configuration release --framework netcoreapp2.1 -o ./$ZIPPED_APPLICATION
            - aws cloudformation package --template-file infrastructure.yml --s3-bucket $S3_DEPLOYMENT_BUCKET --output-template-file packaged-infrastructure.yml --region us-east-2
            - aws cloudformation deploy --template-file packaged-infrastructure.yml --stack-name $CLOUDFORMATION_STACK_NAME --capabilities CAPABILITY_IAM --region us-east-2

运行dotnet restore时构建过程失败。

我假设我需要以某种方式修改buildspec.yml文件,以使构建过程知道如何查看正确的软件包存储库(我们的私有GitHub软件包存储库)。尝试查找datastop.io.data-dictionary软件包时,如何修改buildspec.yml文件以指向相应的GitHub软件包存储库?

aws-codebuild github-package-registry
1个回答
0
投票

如果将nuget.config文件添加到项目中,然后将GitHub存储库添加到该配置中,它将知道在哪里查找。从那里开始是一个权限问题,这就是我正在努力解决的问题。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <clear />
        <add key="github" value="https://nuget.pkg.github.com/YOUR_ACCOUNT_NAME/index.json" />
    </packageSources>
</configuration>
© www.soinside.com 2019 - 2024. All rights reserved.