Skip to content

Commit

Permalink
Merge pull request #3 from jlebon/pr/add-config-bot
Browse files Browse the repository at this point in the history
tree: add new config-bot service
  • Loading branch information
jlebon authored Jul 9, 2019
2 parents 5493a60 + 446039f commit 4407586
Show file tree
Hide file tree
Showing 5 changed files with 535 additions and 0 deletions.
8 changes: 8 additions & 0 deletions config-bot/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM registry.fedoraproject.org/fedora:30

RUN dnf -y install git python3-toml python3-aiohttp && dnf clean all

COPY main /usr/lib/config-bot/main
COPY config.toml /etc/config-bot.toml

CMD /usr/lib/config-bot/main
41 changes: 41 additions & 0 deletions config-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# config-bot

config-bot performs automated management tasks on the main
[fedora-coreos-config](https://github.com/coreos/fedora-coreos-config)
repo.

It performs three closely related, but mostly independent
functions. The names below reflect each of those functions.
One can find their corresponding configuration section in
`config.toml` and function names in `main`.

1. `sync-build-lockfiles`: watches for new builds on a set
of streams, and pushes the generated lockfile to their
corresponding branches
2. `promote-lockfiles`: on some configurable interval,
pushes lockfiles from one config branch to another
3. `propagate-files`: watches for pushes to a config branch
and propagates changes to a subset of files to a set of
target branches.

All these are currently timer-based. In the future, they
will use fedora-messaging for triggering.

Similarly, for now all changes are done using `git push`. In
the future, config-bot PR functionality can be added.

## Testing locally

Tweak settings as appropriate in `config.toml`, e.g.:
- point to your fork of `fedora-coreos-config`
- use your own GitHub token
- you can comment out whole sections if you'd like to test a
specific function only; e.g. if you only want to test
`promote-lockfiles`, you can comment out
`sync-build-lockfiles` and `propagate-files`

Then:

```
./main --config myconfig.toml
```
36 changes: 36 additions & 0 deletions config-bot/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[git]
author.name = 'CoreOS Bot'
author.email = '[email protected]'
github.repo.owner = 'coreos'
github.repo.name = 'fedora-coreos-config'
github.token.username = 'coreosbot'
github.token.path = '/var/run/secrets/coreos.fedoraproject.org/github-token/token'

[sync-build-lockfiles]
builds-base-url = 'https://builds.coreos.fedoraproject.org/prod/streams'
streams = [
'bodhi-updates',
]
trigger.mode = 'periodic'
trigger.period = '15m'
method = 'push'

#[promote-lockfiles]
#source-ref = 'bodhi-updates'
#target-ref = 'testing-devel'
#trigger.mode = 'periodic'
#trigger.period = '24h'
#method = 'push'

[propagate-files]
source-ref = 'testing-devel'
target-refs = [
'bodhi-updates',
]
skip-files = [
'manifest.yaml',
'manifest-lock.*',
]
trigger.mode = 'periodic'
trigger.period = '15m'
method = 'push'
Loading

0 comments on commit 4407586

Please sign in to comment.