cdown / travis-automerge

A script to automerge successful builds to a branch
Other
15 stars 16 forks source link

Trouble with generarating public key for the repository #5

Open TrueFinch opened 5 years ago

TrueFinch commented 5 years ago

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/git@github.com:/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*=@github.com/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 commented 5 years ago

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.