5.1 KiB
Basic TravisCI Information
{{#include ../../banners/hacktricks-training.md}}
Access
TravisCIはGithub、Bitbucket、Assembla、Gitlabなどのさまざまなgitプラットフォームと直接統合します。ユーザーに対し、TravisCIと連携したいreposへアクセスするためのTravisCI権限の付与を求めます。
例えばGithubでは、次の権限を求めます。
user:email(read-only)read:org(read-only)repo: 公開および非公開のrepositoriesとorganizationsに対して、code、commit statuses、collaborators、deployment statusesへのread/write accessを付与します。
Encrypted Secrets
Environment Variables
TravisCIでは、他のCI platformsと同様に、repo level secretsとして保存することができ、暗号化されて保存され、buildを実行するmachineのenvironment variableとしてdecryptされて渡されます。
secretsを利用可能にするbranchesを指定することができ(defaultではall)、さらにTravisCIがlogsに表示された場合にその値を隠すべきかどうかも指定できます(defaultでは隠します)。
Custom Encrypted Secrets
各repoごとにTravisCIはRSA keypairを生成し、private側を保持し、repositoryのpublic keyを、それに対してaccessを持つ人に公開します。
1つのrepoのpublic keyには次の方法でアクセスできます:
travis pubkey -r <owner>/<repo_name>
travis pubkey -r carlospolop/t-ci-test
Then, you can use this setup to encrypt secrets and add them to your .travis.yaml. The secrets will be decrypted when the build is run and accessible in the environment variables.
Note that the secrets encrypted this way won't appear listed in the environmental variables of the settings.
Custom Encrypted Files
Same way as before, TravisCI also allows to encrypt files and then decrypt them during the build:
travis encrypt-file super_secret.txt -r carlospolop/t-ci-test
encrypting super_secret.txt for carlospolop/t-ci-test
storing result as super_secret.txt.enc
storing secure env variables for decryption
Please add the following to your build script (before_install stage in your .travis.yml, for instance):
openssl aes-256-cbc -K $encrypted_355e94ba1091_key -iv $encrypted_355e94ba1091_iv -in super_secret.txt.enc -out super_secret.txt -d
Pro Tip: You can add it automatically by running with --add.
Make sure to add super_secret.txt.enc to the git repository.
Make sure not to add super_secret.txt to the git repository.
Commit all changes to your .travis.yml.
ファイルを暗号化する際、リポジトリ内に次のような2つの Env Variables が設定されます:
TravisCI Enterprise
Travis CI Enterprise は、Travis CI のオンプレ版で、あなたの infrastructure にデプロイできます。Travis CI の「server」版のように考えてください。Travis CI を使うことで、自由に構成・保護できる環境で、使いやすい Continuous Integration/Continuous Deployment (CI/CD) システムを有効にできます。
Travis CI Enterprise は、主に 2 つの部分で構成されます:
- バージョン管理システムとの連携、build の認可、build job のスケジューリングなどを担当する TCI services(または TCI Core Services)。
- TCI Worker と build environment images(OS images とも呼ばれる)。
TCI Core services には以下が必要です:
- PostgreSQL11(またはそれ以降)の database。
- Kubernetes cluster をデプロイするための infrastructure。必要に応じて server cluster でも単一マシンでもデプロイできます。
- 構成によっては、一部のコンポーネントを自前でデプロイ・設定したい場合があります。たとえば RabbitMQ です。詳細は Setting up Travis CI Enterprise を参照してください。
TCI Worker には以下が必要です:
- Worker と linked build image を含む docker image をデプロイできる infrastructure。
- 特定の Travis CI Core Services コンポーネントへの接続性。詳細は Setting Up Worker を参照してください。
デプロイされた TCI Worker と build environment OS images の数によって、あなたの infrastructure 上での Travis CI Enterprise デプロイの総同時処理能力が決まります。
{{#include ../../banners/hacktricks-training.md}}
.png)
.png)
.png)
.png)