diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 773bf72..bb9e384 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,6 +46,11 @@ jobs: - run: npm test if: runner.os != 'Linux' + - if: startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' + name: Inject user agent version + run: + sed -i "s/VsceVersion = 'unspecified'/VsceVersion = '${{ github.ref_name }}'/g" src/extension.ts + - name: Validate extension is packable if: runner.os == 'Linux' run: npx vsce package diff --git a/scripts/download-humctl.js b/scripts/download-humctl.js index 54a77fe..706816e 100755 --- a/scripts/download-humctl.js +++ b/scripts/download-humctl.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -const CLI_VERSION = '0.28.0'; +const CLI_VERSION = '0.36.2'; const fs = require('node:fs/promises'); const extractZip = require('extract-zip'); diff --git a/src/adapters/humctl/HumctlAdapter.ts b/src/adapters/humctl/HumctlAdapter.ts index 9ee57bd..6135671 100644 --- a/src/adapters/humctl/HumctlAdapter.ts +++ b/src/adapters/humctl/HumctlAdapter.ts @@ -15,6 +15,7 @@ import { UnsupportedOperatingSystemError } from '../../errors/UnsupportedOperati import path from 'path'; import { ExtensionContext } from 'vscode'; import { NoDeploymentsInEnvironmentError } from '../../errors/NoDeploymentsInEnvironmentError'; +import { VsceVersion } from '../../extension'; export class HumctlAdapter implements IHumctlAdapter { constructor( @@ -42,7 +43,8 @@ export class HumctlAdapter implements IHumctlAdapter { throw new UnsupportedOperatingSystemError(os, arch); } - let humctlEmbeddedBinaryFilename = `cli_0.28.0_${os}_${arch}`; + // TODO: upgrade to a later version once https://github.com/humanitec/cli-internal/pull/257/ is merged. + let humctlEmbeddedBinaryFilename = `cli_0.36.2_${os}_${arch}`; if (os === 'win32') { humctlEmbeddedBinaryFilename += '.exe'; } @@ -134,6 +136,7 @@ export class HumctlAdapter implements IHumctlAdapter { HUMANITEC_ENV: env, HUMANITEC_OUTPUT: 'json', HUMANITEC_CLI_ALPHA_FEATURES: '', + HUMANITEC_OVERRIDE_USER_AGENT: `humanitec-vscode-extension/${VsceVersion}`, }; } } diff --git a/src/extension.ts b/src/extension.ts index a92c3ac..12fb5b2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -23,6 +23,8 @@ import { ActiveResourcesRepository } from './repos/ActiveResourcesRepository'; import { DependencyGraphRepository } from './repos/DependencyGraphRepository'; import { ResourceDefinitionRepository } from './repos/ResourceDefinitionRepository'; +export const VsceVersion = 'unspecified'; + export const loggerChannel = vscode.window.createOutputChannel('Humanitec'); export async function activate(context: vscode.ExtensionContext) {