Skip to content

Commit

Permalink
feat: update embedded humctl and override humanitec user agent to ide…
Browse files Browse the repository at this point in the history
…ntify the user agent (#150)

* feat: override humanitec user agent to identify the user agent

* feat: upgraded humctl version
  • Loading branch information
astromechza authored Jan 23, 2025
1 parent 7eb22c4 commit 3661447
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/download-humctl.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
5 changes: 4 additions & 1 deletion src/adapters/humctl/HumctlAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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';
}
Expand Down Expand Up @@ -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}`,
};
}
}
2 changes: 2 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3661447

Please sign in to comment.