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

Version 1.3.0-alpha breaks backwards-compatibility #527

Closed
Mikaciu opened this issue Oct 14, 2024 · 3 comments
Closed

Version 1.3.0-alpha breaks backwards-compatibility #527

Mikaciu opened this issue Oct 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Mikaciu
Copy link

Mikaciu commented Oct 14, 2024

Hello,

Without the variable USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER set to false, using the credprovider for old dotnet versions is likely to fail.

Dotnet 6 image build

Console output (azure pipelines)

##[error]#12 [build 3/6] RUN curl -sSL https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
##[error]#12 0.270 INFO: Creating the nuget plugin directory (i.e. /root/.nuget/plugins). 
##[error]#12 0.272 Downloading from https://github.com/Microsoft/artifacts-credprovider/releases/latest/download/Microsoft.Net8.NuGet.CredentialProvider.tar.gz
##[error]#12 0.611 tar: invalid magic
##[error]#12 0.611 tar: short read
##[error]#12 0.611 tar: plugins/netcore: not found in archive
##[error]#12 ERROR: process "/bin/bash -eo pipefail -c curl -sSL https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash" did not complete successfully: exit code: 1

Docker image

FROM mcr.microsoft.com/dotnet/sdk:6.0-alpine3.16 AS build

# Install Bash
# hadolint ignore=DL3018
RUN set -eu \
    && apk add --no-cache --update bash curl

# Install Credential Provider and set env variables to enable Nuget restore with auth
ARG PAT
ARG NUGET_ENDPOINT="https://pkgs.dev.azure.com/xxx"
ARG \
  USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER="false"

SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
# hadolint ignore=SC2016
RUN curl -sSL https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED=true
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{"endpointCredentials": [{"endpoint":"'${NUGET_ENDPOINT}'", "password":"'${PAT}'"}]}'

Dotnet 3.1 image build

Console output (azure pipelines)

##[error]#13 [build 3/7] RUN curl -sSL https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
##[error]#13 0.320 INFO: Creating the nuget plugin directory (i.e. /root/.nuget/plugins). 
##[error]#13 0.322 Downloading from https://github.com/Microsoft/artifacts-credprovider/releases/latest/download/Microsoft.Net8.NuGet.CredentialProvider.tar.gz
##[error]#13 0.670 tar: invalid magic
##[error]#13 0.670 tar: short read
##[error]#13 0.671 tar: plugins/netcore: not found in archive
##[error]#13 ERROR: process "/bin/bash -eo pipefail -c curl -sSL https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash" did not complete successfully: exit code: 1
##[error]------
##[error] > [build 3/7] RUN curl -sSL https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash:
##[error]0.320 INFO: Creating the nuget plugin directory (i.e. /root/.nuget/plugins). 
##[error]0.322 Downloading from https://github.com/Microsoft/artifacts-credprovider/releases/latest/download/Microsoft.Net8.NuGet.CredentialProvider.tar.gz
##[error]0.670 tar: invalid magic
##[error]0.670 tar: short read
##[error]0.671 tar: plugins/netcore: not found in archive

Dockerfile

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine3.10 AS build

RUN set -eu \
    && apk add --no-cache --update bash~=5.0 curl~=7.66

# Install Credential Provider and set env variables to enable Nuget restore with auth
ARG PAT
ARG NUGET_ENDPOINT="https://pkgs.dev.azure.com/xxx"
ARG USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER="false"

SHELL ["/bin/bash", "-eo", "pipefail", "-c"]
RUN curl -sSL https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash
ENV NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED true
ENV VSS_NUGET_EXTERNAL_FEED_ENDPOINTS '{"endpointCredentials": [{"endpoint":"'${NUGET_ENDPOINT}'", "password":"'${PAT}'"}]}'

The issue here is that the shortened URL https://aka.ms/install-artifacts-credprovider.sh is pointing to the master branch of this repo, which is currently an alpha version.

Maybe it would be possible to have a separate channel or a separate URL for alpha versions of the cred provider ?

Thanks !

@Spawney
Copy link

Spawney commented Oct 14, 2024

What was happening for me, when using:

ENV USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER false

In the dockerfile, is that it was looking for:

https://github.com/Microsoft/artifacts-credprovider/releases/download/v1.2.3/Microsoft.Net8.NuGet.CredentialProvider.tar.gz

Which doesnt exist in 1.2.3 version anymore.

I have had to specify the alpha build using:

ENV AZURE_ARTIFACTS_CREDENTIAL_PROVIDER_VERSION=v1.3.0-alpha

@cobya cobya self-assigned this Oct 15, 2024
@cobya cobya added the bug Something isn't working label Oct 15, 2024
@cobya
Copy link
Contributor

cobya commented Oct 15, 2024

Should be resolved when #528 is merged. Sorry for the inconvenience everyone, we have some follow up items from this to make our CI validation better for these install scripts - I'll also bring up the idea of "pre-release" install scripts for folks who want to test changes early.

@cobya
Copy link
Contributor

cobya commented Oct 16, 2024

Please let me know if you're still facing any failures with the changes from #528 or mark the issue as resolved if it's no longer occurring.

@cobya cobya closed this as completed Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants