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

feat: clean up user agent #231

Merged
merged 2 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions setup-gcloud/src/setup-gcloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ import { promises as fs } from 'fs';
import path from 'path';
import { v4 as uuidv4 } from 'uuid';

export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';

export async function run(): Promise<void> {
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
try {
let version = core.getInput('version');
if (!version || version == 'latest') {
Expand Down
3 changes: 1 addition & 2 deletions setupGcloudSDK/src/format-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import * as httpm from 'typed-rest-client/HttpClient';
import { retry } from '@lifeomic/attempt';
import { GCLOUD_METRICS_LABEL } from './install-util';

/**
* Formats the gcloud SDK release URL according to the specified arguments.
Expand Down Expand Up @@ -68,7 +67,7 @@ export async function getReleaseURL(
): Promise<string> {
try {
const url = formatReleaseURL(os, arch, version);
const client = new httpm.HttpClient(GCLOUD_METRICS_LABEL);
const client = new httpm.HttpClient('github-actions-setup-gcloud-sdk');
return retry(
async () => {
const res = await client.head(url);
Expand Down
4 changes: 0 additions & 4 deletions setupGcloudSDK/src/install-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ import * as toolCache from '@actions/tool-cache';
import * as core from '@actions/core';
import path from 'path';

export const GCLOUD_METRICS_ENV_VAR = 'CLOUDSDK_METRICS_ENVIRONMENT';
export const GCLOUD_METRICS_LABEL = 'github-actions-setup-gcloud';

/**
* Installs the gcloud SDK into the actions environment.
*
Expand All @@ -39,6 +36,5 @@ export async function installGcloudSDK(
let toolPath = await toolCache.cacheDir(toolRoot, 'gcloud', version);
toolPath = path.join(toolPath, 'bin');
core.addPath(toolPath);
core.exportVariable(GCLOUD_METRICS_ENV_VAR, GCLOUD_METRICS_LABEL);
return toolPath;
}
5 changes: 3 additions & 2 deletions setupGcloudSDK/src/version-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@

import * as httpm from 'typed-rest-client/HttpClient';
import { retry } from '@lifeomic/attempt';
import { GCLOUD_METRICS_LABEL } from './install-util';

/**
* @returns The latest stable version of the gcloud SDK.
*/
export async function getLatestGcloudSDKVersion(): Promise<string> {
const queryUrl =
'https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json';
const client: httpm.HttpClient = new httpm.HttpClient(GCLOUD_METRICS_LABEL);
const client: httpm.HttpClient = new httpm.HttpClient(
'github-actions-setup-gcloud-sdk',
);
return await retry(
async () => {
const res = await client.get(queryUrl);
Expand Down