This tool listens for HTTP Post requests coming from Gogs and on tag creation
+ push to master
events, it will execute Docker, targeting build.json
file
at the root of the target repository, passing the REF build argument, populated with the received ref
.
- Notifications of build start, success and failure are pushed to telegram.
- The notifications include a link to see the build logs.
- Build artifacts are pushed to S3.
This project currently only builds nodejs projects by running npm install; npm run build
- Populate a
build.json
file at the root of the repository
{
"subprojects": [
{
"name": "subproject-1",
"dir": "recipes",
"artifacts": ["build/"]
},
{
"name": "subproject-2",
"dir": "ktchn",
"artifacts": ["dist/bundle.js"]
}
]
}
- Create a webhook in gogs, you can do this in the UI or by posting to the API (see here)
ACCESS_TOKEN=blah; curl -X POST http://gogs.labs/api/v1/repos/:username/:reponame/hooks\
-H "Authorization: token ${ACCESS_TOKEN}"\
-H "Content-Type: application/json"\
--data '{"type": "gogs",
"config": {"url": "http://ci.labs:8080/hook", "content_type": "json"},
"events": ["create", "push"]}'
(To create an access token go to your personal account -> settings -> applications -> generate new token)
- Per-Build lock to avoid concurrent builds (or clone once per tag?)
The following environment variables are used
S3_ACCESS_KEY=access_key
S3_SECRET_KEY=secret_key
TELEGRAM_BOT_KEY=XXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
{
"LogPath": "/tmp/",
"repoCloneBase": "/tmp/",
"BuildDockerfilePath": "/home/ci/Dockerfile",
"Repos": [
{
"Name": "Recipes",
"GitUrl": "ssh://git@gogs:2222/tati/kitchn.git",
"Bucket": "recipes",
"TelegramChatId": -311945893
},
{
"Name": "Test Repo",
"GitUrl": "ssh://git@gogs:2222/david/test.git",
"Bucket": "testrepo",
"TelegramChatId": 1719831
}
]
}