travis-automerge icon indicating copy to clipboard operation
travis-automerge copied to clipboard

Trouble with generarating public key for the repository

Open TrueFinch opened this issue 6 years ago • 1 comments

This command travis encrypt -r user/repo 'GITHUB_SECRET_TOKEN=<your token>'generated wrong keys for me. In console i've got something like that:

Setting environment variables from .travis.yml
$ export GITHUB_SECRET_TOKEN=[secure]
The previous command failed, possibly due to a malformed secure environment variable.
Please be sure to escape special characters such as ' ' and '$'.
For more information, see https://docs.travis-ci.com/user/encryption-keys.

This is my travis.yml:

sudo: true
dist: xenial
language: cpp

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
env:
  - secure: "key"

git:
  submodules: false
  
before_install:
  - sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
  - git submodule update --init --recursive
  
script:
  - mkdir build
  - cd build
  - cmake .. 
  - cmake --build .
  - "./tests/tests [implemented]"
after_success:
  - ls
  - echo $TRAVIS_COMMIT
  - echo $TRAVIS_BRANCH
  - cd ..
  - curl -o /tmp/travis-automerge https://raw.githubusercontent.com/kappatych/travis-automerge/master/travis-automerge
  - chmod a+x /tmp/travis-automerge
  - BRANCHES_TO_MERGE_REGEX='^f.*' BRANCH_TO_MERGE_INTO=develop GITHUB_REPO=kappatych/ci_test /tmp/travis-automerge

Also tried to set key through environment variables on the site, but it did not work too and throw such exception: fatal: unable to access 'https://*generated key here*[email protected]/kappatych/ci_test/': Could not resolve host: *part of generated key here*

Maybe this is my fault. I do not understand why is this happening

TrueFinch avatar Jan 11 '19 12:01 TrueFinch

Found solution. Using such command to encrypt token gives valid key: travis encrypt -r KappaTych/ci_test GITHUB_SECRET_TOKEN="token"

But I still do not understand how to set this variable in the repository settings :(

This is how I put it in travis.yml:

env:
  - secure: "key"

Am I right that this way to store key is not very good? Cause everybody can just get on our repository travis site and get this key. Sounds not very good fo me. Please correct me, if I am wrong.

TrueFinch avatar Jan 11 '19 13:01 TrueFinch