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

NuGetAuthenticate task #11024

Merged
merged 1 commit into from
Aug 1, 2019
Merged

NuGetAuthenticate task #11024

merged 1 commit into from
Aug 1, 2019

Conversation

zarenner
Copy link
Contributor

No description provided.

const credProviderAssemblyPath = locateNetFxCredentialProvider();
tl.setVariable("NUGET_PLUGIN_PATHS", credProviderAssemblyPath);
} catch (error) {
tl.setResult(tl.TaskResult.Failed, error);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we send some telemetry back here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my other comment - I'm holding on adding telemetry until we finish deciding how many tasks we'll have (1 vs the current 3).

@zarenner
Copy link
Contributor Author

@shubham90 FYI still need to add telemetry. Going to hold on that until we finish deciding if we want multiple tasks still or going back to a single task.


tl.debug(`Getting URI for area ID ${areaId} from ${tfsCollectionUrl}`);
try {
const serviceUriFromArea = await locationApi.getResourceArea(areaId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this errors out, it throws a really bad exception message. It would be good to add some additional logging here before throwing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just pulled this as-is from the existing utility, seemed odd to me to immediately re-throw like but I assumed there was a historical reason for it. I can definitely add additional logging.

@zarenner zarenner requested a review from aasim July 29, 2019 18:46
@shubham90
Copy link
Member

Also, I think you'll need to add the new tasks in make-options.json file. Otherwise, build all command won't pick up these tasks.

@thesattiraju thesattiraju self-requested a review July 30, 2019 10:50
@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch 2 times, most recently from ab7e638 to 4bdb4ac Compare July 30, 2019 20:19
tl.setResult(tl.TaskResult.Failed, error);
} finally {
emitTelemetry("Packaging", "NuGetAuthenticate", {
"System.TeamFoundationCollectionUri": tl.getVariable("System.TeamFoundationCollectionUri")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not emitting anything interesting here yet, and I'm unsure why recording the collection uri is important but we seem to do so in our other tasks.

All the interesting stuff I want to record is in artifacts-common - @jotaylo @shubham90 is there any issue with emitting telemetry multiple times?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why we're logging that everywhere, other than potentially making searches by collection a fraction easier. I'm all for removing it.

There's no issue with emitting telemetry multiple times.

@zarenner zarenner changed the title NuGet-related authentication tasks [wip] NuGetAuthenticate task Jul 30, 2019
@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch from 4bdb4ac to 03067a5 Compare July 30, 2019 21:38
@zarenner zarenner requested review from thesattiraju and removed request for madhurig, hashtagchris, nishubansal and thesattiraju July 30, 2019 21:43
@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch from 03067a5 to 9d2a457 Compare July 30, 2019 22:57
@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch 2 times, most recently from 8fbdad3 to 759a758 Compare July 31, 2019 20:40
@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch 3 times, most recently from 3b1e8e2 to 8c59576 Compare July 31, 2019 21:39
@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch from 8c59576 to b13064a Compare August 1, 2019 01:30
let serviceConnections: ServiceConnection[] = [];
endpointNames.forEach((endpointName: string) => {
let uri = tl.getEndpointUrl(endpointName, false);
let endpointAuth = tl.getEndpointAuthorization(endpointName, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some service connections we also have a data parameter, for example Pip and Twine (and now also Maven) we get the endpointname data parameter which we use while generating the authorizations in the respective files.

These parameters come in the form ENDPOINT_DATA_<endpointName>_<key>. Should we add something like an additional properties field to the service connection types and populate them with all the data keys we find? If we want other tasks to also use this library we would have to add some way to enable this functionality or else they will have to write custom logic to just get the data parameters. Let me know your thoughts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, feel free to do this as needed.

import { IRequestOptions } from 'azure-devops-node-api/interfaces/common/VsoBaseInterfaces';
import * as tl from 'azure-pipelines-task-lib/task';

export function getWebApiWithProxy(serviceUri: string, accessToken: string): api.WebApi {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we accept an optional 'options' parameter? For some use cases, for example where we return a redirect to a blobstore url in the content apis, we need to pass in additional options which specify to not forward auth headers (like the options defined here: https://github.com/microsoft/typed-rest-client/blob/master/lib/HttpClient.ts#L392). We can merge the users and our options before creating the client.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me, feel free to change it as needed when you merge your changes with this.

@zarenner zarenner force-pushed the users/zarenner/nugetAuthenticate branch from b13064a to aa12108 Compare August 1, 2019 17:19
@zarenner zarenner merged commit d925deb into master Aug 1, 2019
@zarenner zarenner deleted the users/zarenner/nugetAuthenticate branch August 1, 2019 17:26
@zarenner zarenner restored the users/zarenner/nugetAuthenticate branch August 2, 2019 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants