CircleCI-Public / circleci-cli

Use CircleCI from the command line
https://circleci-public.github.io/circleci-cli/
MIT License
408 stars 232 forks source link

circleci context store-secret -> adds at the end of the value "," #749

Open bogdanrn opened 2 years ago

bogdanrn commented 2 years ago

Meta:

circleci context store-secret github my-org my-context my-env <<< "production"

CircleCI CLI Version: 0.1.19666+830e7ff (release)

Operating System: Mac OS 12.4

CircleCI CLI Diagnostic:

---
CircleCI CLI Diagnostics
---
Debugger mode: false
Config found: /Users/bogdan/.circleci/cli.yml
API host: https://circleci.com
API endpoint: graphql-unstable
OK, got a token.
Trying an introspection query on API...
Ok.
Hello, Bogdan Radu.

Current behavior:

circleci context store-secret github my-org my-context MY_ENV <<< "production"

$MY_ENV will be set as production,

Expected behavior:

$MY_ENV should be production not production,

When did this begin / Was this previously working?:

before upgrading cli to version 0.1.19666+830e7ff (release) it worked as expcted

Additional Information:

I was using a node script to call the context updater

#!/usr/bin/env node

const { execSync } = require("child_process");
const config = {
  MY_ENV: 'production',
  MY_FIRST_VAR: 'TEST-1'
}

const contextName = 'myContext';
const orgName = 'myOrg';

for (key in config) {
  const value = config[key];
  console.log(`Setting key ${contextName}[${key}]=${value}`);

  try {
    const cmd = `circleci context store-secret github ${orgName} ${contextName} ${key} <<< "${value}"`;
    console.log(execSync(cmd).toString());
  } catch (error) {
    console.log(
      `Key: ${key} Status Code: ${error.status} with '${error.message}'`
    );
  }
}
Maxim-Filimonov commented 1 year ago

I do wonder if circleci team responds to those bugs at all. This issue has been in the issue tracker for 2 years and we have just lost a day investigating the source of weirdest failures.