> For the complete documentation index, see [llms.txt](https://yutakatay.gitbook.io/katapedia/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yutakatay.gitbook.io/katapedia/doc/ci.md).

# CI

## Tips

### SSHの鍵を登録する

`ssh-keygen -t rsa -b 4096 -N '' -C "gitlab-ci@xxx"`

```
if [[ ! -d ~/.ssh ]]; then
    mkdir -p ~/.ssh
fi

if [[ -z "$PRIVATE_KEY" ]]; then
    echo "PRIVATE_KEY is not defined"
    exit 1
fi

echo "$PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
ssh-keyscan www.example.com >> ~/.ssh/known_hosts
```
