Skip to content

Commit

Permalink
Merge branch 'main' into T316958
Browse files Browse the repository at this point in the history
  • Loading branch information
vivian-rook authored Sep 20, 2022
2 parents 9d1bd15 + ea7a4a2 commit 55a7ddf
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 25 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/blubber.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---

name: "build and run docker"

'on':
pull_request:

jobs:
docker-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: run blubber
run: |
curl -s -H 'content-type: application/yaml' --data-binary @".pipeline/blubber.yaml" https://blubberoid.wikimedia.org/v1/quarry-test | docker build --tag blubber-quarry:01 --file - .
- name: run blubber container
run: |
docker run blubber-quarry:01
25 changes: 0 additions & 25 deletions .github/workflows/lint.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/notification.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---

name: "PR Notification"

'on':
pull_request:
types: [opened, closed]

jobs:
irc-notification:
runs-on: ubuntu-latest
name: Notify on IRC
steps:
- name: irc notification
run: |
sudo apt-get update
sudo apt-get install netcat -y
message="${{ github.actor }} ${{ github.event.action }} ${{ github.event.pull_request._links.html.href }}"
echo -e "USER notefromgithub notefromgithub notefromgithub :notefromgithub\nNICK notefromgithub\nJOIN #wikimedia-cloud-feed\nPRIVMSG #wikimedia-cloud-feed :${message}\nQUIT\n" | nc irc.libera.chat 6667
phabricator-comment:
runs-on: ubuntu-latest
name: Comment on Phabricator
steps:
- uses: actions/checkout@v2
- name: post to phabricator
run: |
message="${{ github.actor }} ${{ github.event.action }} ${{ github.event.pull_request._links.html.href }}"
git fetch
inital_commit=$(git log origin/main..origin/${{ github.head_ref }} --pretty=%H | tail -n1)
task=$(git log -n 1 ${inital_commit} | tail -n1 | grep "^ Bug: T[0-9]*$" | awk '{print $2}')
# if already squashed and merged use the branch name.
if [ -z "${task}" ]; then
task=$(git log -n 1 origin/${{ github.head_ref }} | tail -n1 | grep "^ Bug: T[0-9]*$" | awk '{print $2}')
fi
if [ -n "${task}" ]; then
curl https://phabricator.wikimedia.org/api/maniphest.edit \
-d api.token=${{ secrets.TOOLFORGE_PHAB_BOT_KEY }} \
-d transactions[0][type]=comment \
-d transactions[0][value]="${message}" \
-d objectIdentifier=${task}
fi
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,12 @@ To pre-compile nunjucks templates:

See also commands listed in the mainters documentation:
https://wikitech.wikimedia.org/wiki/Portal:Data_Services/Admin/Quarry

## Comment to Phabricator ##

To have a PR make comments to an associated phabricator ticket have the last line of the commit look like:

Bug: <ticket number>

For example:
Bug: T317566
Binary file added quarry/web/static/img/favicon-running.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions quarry/web/static/js/query/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ $( function () {
} );

$( '#stop-code' ).click( function () {
// revert favicon to default color
var favicon = document.querySelector("link[rel='icon']");
favicon.href = '/static/img/favicon.png';

$.post( '/api/query/stop', {
query_database: $( '#query-db' ).val(),
qrun_id: vars.qrun_id
Expand All @@ -193,6 +197,10 @@ $( function () {
} );

$( '#run-code' ).click( function () {
// update favicon to running color
var favicon = document.querySelector("link[rel='icon']");
favicon.href = '/static/img/favicon-running.png';

$.post( '/api/query/run', {
text: editor !== null ? editor.getValue() : $( '#code' ).val(),
query_database: $( '#query-db' ).val(),
Expand Down Expand Up @@ -242,6 +250,10 @@ $( function () {
let title = $( '#title' ).val() ? '"' + $( '#title' ).val() + '"' : 'Untitled query #' + vars.query_id;
sendNotification( title + ' execution has been completed' );
}

// revert favicon to default color
var favicon = document.querySelector("link[rel='icon']");
favicon.href = '/static/img/favicon.png';
} else if ( data.status === 'queued' || data.status === 'running' ) {
window.lastStatusCheck = setTimeout( function () {
checkStatus( qrun_id, false );
Expand Down

0 comments on commit 55a7ddf

Please sign in to comment.