Gitlab pipeline running into errors when adding NuGet source

Viewed 136

I am trying to add a pipeline to my project. The project is a AWS Lambda written in dotnet. I want to build a pipeline so that it is deployed to AWS whenever I update the code of my Lambda. Here is my code for the pipeline:

image: mcr.microsoft.com/dotnet/core/sdk:3.1

stages:
  - build
  - deploy
  - production

before_script:
  - apt update
  - apt-get -y install zip
  - export PATH="$PATH:/root/.dotnet/tools"
  - dotnet tool install -g Amazon.Lambda.Tools

build:
  stage: 'build'
  script: 
    - export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
    - export AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION
    - export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
    - echo `aws ecr get-login --no-include-email --region $AWS_DEFAULT_REGION` | sh
    - dotnet nuget add sourceĀ url
    - dotnet restore
    - cd SmoothRunningsAuth
    - dotnet lambda package -o publish/$CI_PIPELINE_ID.zip
  when: always
  artifacts:
    name: "$CI_JOB_NAME"
    paths:
      - project/publish/$CI_PIPELINE_ID.zip

I have tested all of these commands locally and they work fine when I build the package. dotnet nuget add source url is required as I am using packages from a private repository I am using.

However when I push this to GitLab it returns the following errors:

enter image description here

I am not sure why this is happening, it runs all the other dotnet commands fine and this is the command I use when I am trying to add sources.

0 Answers
Related