No idea what I did or whether it works

This commit is contained in:
Benjamin Bädorf 2021-06-15 01:21:08 +02:00
parent 110909f7a1
commit 8345f3a6f4
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C
3 changed files with 27 additions and 41 deletions

View file

@ -1,6 +1,6 @@
kind: pipeline
type: docker
name: upstreaming
name: Upstreaming
steps:
- name: "Sync upstream to local"
@ -11,11 +11,13 @@ steps:
- promote
target:
- upstream
branch:
- core
environment:
GITEA_SSH_KEY:
from_secret: gitea_ssh_key
commands:
- sh .drone/setup_ssh.sh
- ./.drone/setup_ssh.sh
- git fetch
- git checkout devos
- git remote add devos git@git.b12f.io:pub-solar/devos
@ -24,7 +26,7 @@ steps:
- git merge -X theirs devos/core
- git push origin devos
- name: "Sync core with upstream"
- name: "Sync branch with upstream"
image: alpine/git
when:
status:
@ -34,39 +36,12 @@ steps:
- promote
target:
- upstream
depends_on:
- "Sync upstream to local"
environment:
GITEA_SSH_KEY:
from_secret: gitea_ssh_key
commands:
- git checkout feat/upstreaming
- sh .drone/setup_ssh.sh
- git fetch --all
- git checkout --track origin/core
- git merge origin/devos
- git push origin core
- name: "Notify success"
image: plugins/matrix
when:
status:
- success
event:
- cron
- promote
target:
- upstream
depends_on:
- "Sync core with upstream"
settings:
homeserver: https://matrix.pub.solar
roomid: dfQBqwkhIzrFjMSsxy:pub.solar
username:
from_secret: matrix_username
password:
from_secret: matrix_password
template: Upstreaming devos into core succeeded.
- ./.drone/setup_ssh.sh
- ./.drone/upstream-branch.sh
- name: "Open pull request for failed merge"
image: nixery.dev/shell/tea
@ -78,8 +53,8 @@ steps:
- promote
target:
- upstream
depends_on:
- "Sync core with upstream"
branch:
- core
environment:
TEA_CONFIG:
from_secret: tea_config
@ -88,18 +63,14 @@ steps:
- echo "$$TEA_CONFIG" > ~/.config/tea/config.yml
- tea pulls create --base core --head devos
- name: "Notify failure"
- name: "Notify matrix"
image: plugins/matrix
when:
status:
- success
event:
- cron
- promote
target:
- upstream
depends_on:
- "Open pull request for failed merge"
settings:
homeserver: https://matrix.pub.solar
roomid: dfQBqwkhIzrFjMSsxy:pub.solar
@ -107,4 +78,4 @@ steps:
from_secret: matrix_username
password:
from_secret: matrix_password
template: Upstreaming devos into core failed. A pull request has been created https://git.b12f.io/pub-solar/os/pulls
template: "Upstreaming {{ build.status }} [{{ build.branch }}#{{ truncate build.commit 8 }}]({{ build.link }}) by {{ build.author }}. [Pull requests](https://git.b12f.io/pub-solar/os/pulls)"

View file

@ -1,4 +1,7 @@
#!/bin/bash
#!/usr/bin/env sh
set -e
# Setup ssh inside container
mkdir -p ~/.ssh
echo "$GITEA_SSH_KEY" > ~/.ssh/id_rsa

12
.drone/upstream-branch.sh Normal file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env sh
set -e
set -u
LOCAL="$DRONE_BRANCH"
[ "$LOCAL" = "core" ] && UPSTREAM=origin/devos || UPSTREAM=origin/core
git fetch --all
git checkout --track origin/"$LOCAL"
git merge "$UPSTREAM"
git push origin "$LOCAL"