Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ExchangeUnion/xud-docker
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: be7f8a359bc37945393b0d04727ef46922f72ee6
Choose a base ref
..
head repository: ExchangeUnion/xud-docker
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5e60a0145eab119c1f4274a5860ad582a73d1a5c
Choose a head ref
Showing with 79 additions and 12 deletions.
  1. +1 −5 .github/workflows/{ci.yml → auto-build.yml}
  2. +56 −0 .github/workflows/manual-build.yml
  3. +2 −2 images/utils/launcher/check_wallets.py
  4. +7 −5 tools/core/image.py
  5. +13 −0 tools/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: Auto Build

on: push

@@ -24,8 +24,6 @@ jobs:
with:
python-version: '3.9'
architecture: 'x64'
- name: Show Python version
run: python -c "import sys; print(sys.version)"
- name: Build and push
run: tools/push -p linux/amd64
build-arm64:
@@ -49,7 +47,5 @@ jobs:
with:
python-version: '3.9'
architecture: 'x64'
- name: Show Python version
run: python -c "import sys; print(sys.version)"
- name: Build and push
run: tools/push -p linux/arm64
56 changes: 56 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Manual Build

on:
workflow_dispatch:
inputs:
images:
description: 'Images to build'
required: true

jobs:
build-amd64:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Build and push
run: tools/push -p linux/amd64 ${{ github.event.inputs.images }}
build-arm64:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
architecture: 'x64'
- name: Build and push
run: tools/push -p linux/arm64 ${{ github.event.inputs.images }}
4 changes: 2 additions & 2 deletions images/utils/launcher/check_wallets.py
Original file line number Diff line number Diff line change
@@ -399,7 +399,7 @@ def setup_backup_dir(self):
print(f"Failed. ", end="")
self.logger.debug(f"Failed to check backup dir {backup_dir}: {reason}")
sys.stdout.flush()
r = self.shell.no_or_yes("Retry?")
r = self.shell.yes_or_no("Retry?")
if r == "no":
self.node_manager.down()
raise FatalError("Backup directory not available")
@@ -461,7 +461,7 @@ def setup_restore_dir(self) -> None:
print(f"Path not available. ", end="")
self.logger.info(f"Failed to check restore dir {restore_dir}: {reason}")
sys.stdout.flush()
r = self.shell.yes_or_no("Do you wish to continue WITHOUT restoring channel balance, keys and historical data?")
r = self.shell.no_or_yes("Do you wish to continue WITHOUT restoring channel balance, keys and historical data?")
if r == "yes":
restore_dir = "/tmp/fake-backup"
break
12 changes: 7 additions & 5 deletions tools/core/image.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@

from .docker import ManifestList
from .src import SourceManager
from .utils import execute
from .utils import execute, get_github_job_url

if TYPE_CHECKING:
from .toolkit import Platform, Context
@@ -71,7 +71,7 @@ def get_shared_dir(self):
def get_labels(self, application_revision) -> List[str]:
image_revision = ""
image_source = ""
image_travis = ""
image_ci = ""

if self.revision:

@@ -81,15 +81,17 @@ def get_labels(self, application_revision) -> List[str]:
source = "{}/blob/{}/images/{}/Dockerfile".format(self.context.project_repo, image_revision, self.name)
image_source = source

if "TRAVIS_BUILD_WEB_URL" in os.environ:
image_travis = os.environ["TRAVIS_BUILD_WEB_URL"]
if "GITHUB_RUN_ID" in os.environ:
run_id = os.environ["GITHUB_RUN_ID"]
job_name = os.environ["GITHUB_JOB"]
image_ci = get_github_job_url(run_id, job_name)

prefix = self.label_prefix

return [
f"--label {prefix}.image.revision='{image_revision}'",
f"--label {prefix}.image.source='{image_source}'",
f"--label {prefix}.image.travis='{image_travis}'",
f"--label {prefix}.image.ci='{image_ci}'",
f"--label {prefix}.application.revision='{application_revision}'",
# TODO remove labels below
f"--label {prefix}.image.branch='master'",
13 changes: 13 additions & 0 deletions tools/core/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
from subprocess import check_output, STDOUT
from urllib.request import urlopen
import json
from typing import Optional


def execute(cmd: str) -> str:
output = check_output(cmd, shell=True, stderr=STDOUT)
return output.decode()


def get_github_job_url(run_id: str, job_name: str) -> Optional[str]:
url = "https://api.github.com/repos/ExchangeUnion/xud-docker/actions/runs/{}/jobs".format(run_id)
resp = urlopen(url)
j = json.load(resp)
for job in j["jobs"]:
if job["name"] == job_name:
return "https://github.com/ExchangeUnion/xud-docker/runs/{}?check_suite_focus=true".format(job["id"])
return None