This is an AI-powered assistant used by the CoreOS team to make operations (such as pipeline monitoring) easier. It works in Slack or Matrix.
The assistant listens for direct mentions in a chat channel in which it was invited.
-
Install dependencies:
source env/bin/activate # if using a virtualenv pip install -r requirements.txt -
Set environment variables:
For Jenkins:
* `JENKINS_URL`: The URL of your Jenkins server.
* `JENKINS_TOKEN`: Your Jenkins token (often an API token).
If using Slack:
* `SLACK_BOT_TOKEN`: Your Slack bot token.
* `SLACK_APP_TOKEN`: Your Slack app token.
If using Matrix:
* `MATRIX_SERVER`: Your homeserver (i.e. https://matrix.org)
* `MATRIX_ACCESS_TOKEN`: Your device access token
* `MATRIX_ROOM`: Your room FQDN (i.e. `#tmp-coreos-pipeline-assistant-testing:matrix.org`)
If using GEMINI:
* `GEMINI_API_KEY`: (OPTIONAL) Your Gemini API key.
If using OpenRouter:
* `OPENROUTER_API_KEY`: (OPTIONAL) Your OpenRouter access key
-
Run the bot:
source env.sh # tokens env vars source env/bin/activate # if using a virtualenv python main.py -
Invite the bot to your channel.
-
Mention the bot in a thread of a Jenkins failure notification. The bot will then reply with a summary of the failure.
-
Build the container image:
podman build -t coreos-ops-assistant . -
Run the container: You can pass the environment variables directly with the
-eflag, or you can use a.envfile.Using the
-eflag:# First export the appropriate variables in your environment based # on what you are using (i.e. slack/matrix and gemini/openrouter) export SLACK_BOT_TOKEN='your_bot_token' export SLACK_APP_TOKEN='your_app_token' export MATRIX_SERVER='https://matrix.org' export MATRIX_ACCESS_TOKEN='your_app_token' export MATRIX_ROOM='your_room_fqdn' export JENKINS_URL='https://your.jenkins.url' export JENKINS_TOKEN='your_jenkins_token' export GEMINI_API_KEY='your_api_key' export OPENROUTER_API_KEY='your_api_key' # Now run `podman` and it will pull the values from the variables # already set in your environment. podman run -it --rm \ -e SLACK_BOT_TOKEN \ -e SLACK_APP_TOKEN \ -e MATRIX_SERVER \ -e MATRIX_ACCESS_TOKEN \ -e MATRIX_ROOM \ -e JENKINS_URL \ -e JENKINS_TOKEN \ -e GEMINI_API_KEY \ -e OPENROUTER_API_KEY \ coreos-ops-assistantUsing a
.envfile: Create a file named.envwith the following content:SLACK_BOT_TOKEN=your_bot_token SLACK_APP_TOKEN=your_app_token MATRIX_SERVER=https://matrix.org MATRIX_ACCESS_TOKEN=your_app_token MATRIX_ROOM=your_room_fqdn JENKINS_URL=https://your.jenkins.url JENKINS_TOKEN=your_jenkins_token GEMINI_API_KEY=your_api_key OPENROUTER_API_KEY=your_api_keyThen run the container with the
--env-fileflag:podman run -it --rm --env-file .env coreos-ops-assistant
To run the unit tests, run the following command from the root of the project:
python3 test.py