Hi All,
anyone could help me as I'm pulling my hair in several days. :(
So I want to publish the class library as NuGet package to Code Artifact.
I was successfully push the nuget package from my local window powershell through aws cli.
Then now I need to make it run in the CI/CD.
I'm using the bitbucket as git server repository and use the bitbucket pipeline as well.
I was created a new docker image for NET 7 from mcr.microsoft.com/dotnet/sdk:7.0
then install the awscliv2 to this image
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
export PATH=~/bin:$PATH
then this image is pushed to aws ecr and will be used in my bitbucket pipeline.
here my bitbucket pipeline .yml file
image:
name: XXXXXXX.dkr.ecr.ap-southeast-2.amazonaws.com/buz-build-environment:dotnet-7.0
aws:
access-key: $AWS_ACCESS_KEY_ID
secret-key: $AWS_SECRET_ACCESS_KEY
options:
docker: true
pipelines:
default:
- step:
script: # Modify the commands below to build your repository.
# Restore packages
- dotnet restore
# Build project
- dotnet build MyProject.sln
# AWS version and login to codeartifact
- dotnet --version #return 7.0.400
- aws --version #return aws-cli/2.13.17 Python/3.11.5 Linux/5.15.0-1040-aws exe/x86_64.debian.11 prompt/off
- aws codeartifact login --tool dotnet --domain $AWS_CODE_ARTIFACT_DOMAIN --repository $AWS_CODE_ARTIFACT_REPO
And the pipeline is failed with error message: Failed to update the NuGet.Config
The full detail error:
+ aws codeartifact login --tool dotnet --domain $AWS_CODE_ARTIFACT_DOMAIN --repository $AWS_CODE_ARTIFACT_REPO
Failed to update the NuGet.Config
Command '['dotnet', 'nuget', 'add', 'source', 'https://<my-domain>-<aws_account_id>.d.codeartifact.ap-southeast-2.amazonaws.com/nuget/<my-repository>/v3/index.json', '--name', '<domain>/<repo_name>', '--username', 'aws', '--password', '<login_token>_sImlzdSI6MTY5NDQ4NjUwNywiZW5jIjoiQTEyOEdDTSIsInRhZyI6Ikd3b1RLY3liZ2xvdVNibjNrSnlCbUEiLCJleHAiOjE2OTQ1Mjk3MDcsImFsZyI6IkExMjhHQ01LVyIsIml2IjoiSm12cTZWQ3NTTV9XOWtSTiJ9.njrny4bk0JOWUP_WmRrOUA.39SlMqAltqA2rNCB.6Ikpzpnc73IyWBs-smpK0h82RbeiyJ22I4STcfMdCKrgLylb_VwXE03afdnqItp7ny5zvfONYZOXYvOIwOm3b24r7xHZr4meqfVwbnfjq5bW1K2h4nafV29oOO1AMdyj2spgW5r4ZI2nBd57dadgztXrTAc9PXurj0Ugob5zj0x8jYwqvF-e847_zLiTeURnNFo2oQvp6ifr0yZyez-AOlQtKWx6eZw55lkPfOa0tD2ijVWkHBzbyRzjW4LdvoFiJ8fkp6yUhOi3zsWrXFEUngET-e0eWDLTx_yaOUAoCblSiz-yirdVfVSUiPzj2StZPvz3VYtSyMTKUUjEW6dvf3Bjhk-uYxYA4VppNf7ZjO6WZdsYmDDsKHzPN10h8hTelrh10ekSlrPk36UDk-OiXeuKI_nVPSHEtmuB8xCv21EAZLqdteWBBVlfZtYqoMDfOM_ZvLrS5XARYXoEH0JWQcPNWoRTMENmsqb_zSX9bpK7GxD54dVEhNf1FWZVuUoAVqa-axD4YZmvt4DeBIufhG2Q7GKWb53UlY4jyA4vyNw-vkb8xXnFgg4QkYH2cwEzGO12Ozpsdd1vuIjuJCKERP-IuqEgqb97RhHtFfhYh25nOCj-pi_4d2BBddtYlcPV8MxdfBIURNC-bsxArwp64q9YeOTb5xDT7J2AkxYvfMF9BJAGNd1AUkzujqhVYRCIaoZHohg02t-W5SInIN_IYaQN4t6QWlYeUgbSXpyt0qU6PY9GGoNkrXi_jio7mMOWNz1CdpT3iXs68hutbGVnVUs56nsDv372ohNI-04_XdHctiqfTEHLLXZfcY2A3YdeOO23fTZyXstCFU2w2BgwX9lpYOUaFCJCBZ01LtSGYjEkjZSG-6ONCqpZ9LdP4jv-2GZLbyc4Ht92VwFUkArPosLDtBTdN--bFgfpTQWscL413Hq2Mw.rp2-jlZj_yOXKWUMYoVd2w', '--store-password-in-clear-text']' returned non-zero exit status 1.