Skip to content

Commit 087bde5

Browse files
committed
Add !buildkite kernelpush
1 parent b483a60 commit 087bde5

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

cogs/buildkite.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,34 @@ async def forcepush(
190190
else:
191191
await ctx.message.reply(f'failed: ```{resp.text[:1500]}```')
192192

193+
@commands.has_role('Project Director')
194+
@buildkite.command(
195+
name='kernelpush',
196+
help='push upstream kernel branch. example: android_kernel_qcom_sm8750 lineage-22.2 v6.6',
197+
)
198+
async def kernelpush(self, ctx, repo: str, branch: str, src_branch: str):
199+
data = {
200+
'branch': 'main',
201+
'commit': 'HEAD',
202+
'env': {
203+
'REPO': repo,
204+
'DEST_BRANCH': branch,
205+
'SRC_BRANCH': src_branch,
206+
},
207+
'message': f'kernelpush of {repo} by {ctx.message.author.name}',
208+
}
209+
resp = requests.post(
210+
'https://api.buildkite.com/v2/organizations/lineageos/pipelines/kernelpush/builds',
211+
json=data,
212+
headers={
213+
'Authorization': f'Bearer {os.environ.get("BUILDKITE_TOKEN")}'
214+
},
215+
)
216+
if resp.status_code == 201:
217+
await ctx.message.reply(f'started: {resp.json()["web_url"]}')
218+
else:
219+
await ctx.message.reply(f'failed: ```{resp.text[:1500]}```')
220+
193221
@commands.has_role('Project Director')
194222
@buildkite.command(
195223
name='remove',

0 commit comments

Comments
 (0)