Skip to content

Commit 2512e0b

Browse files
committed
Fix linter warnings
Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent 093cf75 commit 2512e0b

File tree

3 files changed

+43
-30
lines changed

3 files changed

+43
-30
lines changed

.github/workflows/docker.yml

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
name: Build and Push Docker Image to GHCR
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
48

5-
permissions:
6-
contents: read # Required to checkout the repo code
7-
packages: write # Required to push packages to GHCR
9+
permissions: {}
810

911
jobs:
1012
xcp-ng-build-env-82:
1113
runs-on: ubuntu-latest
14+
permissions:
15+
packages: write # Required to push packages to GHCR
1216
steps:
1317
- uses: actions/checkout@v4
14-
- uses: docker/setup-buildx-action@v3
18+
with:
19+
persist-credentials: false
20+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
1521
with:
1622
driver: docker-container
17-
- uses: docker/login-action@v3
23+
- uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
1824
if: github.ref == 'refs/heads/master'
1925
with:
2026
registry: ghcr.io
2127
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
2228
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
23-
- uses: docker/build-push-action@v5 # Using v5 for latest features
29+
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
2430
with:
2531
context: ./src/xcp_ng_dev/
2632
file: ./src/xcp_ng_dev/files/Dockerfile-8.x
@@ -35,18 +41,23 @@ jobs:
3541
3642
xcp-ng-build-env-83:
3743
runs-on: ubuntu-latest
44+
permissions:
45+
packages: write # Required to push packages to GHCR
3846
steps:
3947
- uses: actions/checkout@v4
40-
- uses: docker/setup-buildx-action@v3
48+
with:
49+
persist-credentials: false
50+
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
4151
with:
4252
driver: docker-container
43-
- uses: docker/login-action@v3
53+
- uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
4454
if: github.ref == 'refs/heads/master'
4555
with:
4656
registry: ghcr.io
4757
username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
4858
password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
49-
- uses: docker/build-push-action@v5 # Using v5 for latest features
59+
- run: echo "VERSION=$(cat ./src/xcp_ng_dev/files/protocol-version.txt | tr -d '\n')" >> $GITHUB_ENV
60+
- uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
5061
with:
5162
context: ./src/xcp_ng_dev/
5263
file: ./src/xcp_ng_dev/files/Dockerfile-8.x
@@ -60,18 +71,22 @@ jobs:
6071
# TODO: uncomment once we have a public xcp-ng 9.0 repository
6172
# xcp-ng-build-env-90:
6273
# runs-on: ubuntu-latest
74+
# permissions:
75+
# packages: write # Required to push packages to GHCR
6376
# steps:
6477
# - uses: actions/checkout@v4
65-
# - uses: docker/setup-buildx-action@v3
78+
# with:
79+
# persist-credentials: false
80+
# - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
6681
# with:
6782
# driver: docker-container
68-
# - uses: docker/login-action@v3
83+
# - uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1
6984
# if: github.ref == 'refs/heads/master'
7085
# with:
7186
# registry: ghcr.io
7287
# username: ${{ github.actor }} # Uses the GitHub user/org name that triggered the workflow
7388
# password: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub
74-
# - uses: docker/build-push-action@v5 # Using v5 for latest features
89+
# - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
7590
# with:
7691
# context: ./src/xcp_ng_dev/
7792
# file: ./src/xcp_ng_dev/files/Dockerfile-9.x

.github/workflows/main.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,18 @@ on:
66
- 'master'
77
pull_request:
88

9+
permissions: {}
10+
911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
1214
steps:
13-
- uses: actions/checkout@v2
14-
- name: Install uv
15-
uses: astral-sh/setup-uv@v6
16-
with:
17-
version: "0.7.x"
18-
- name: Install dependencies
19-
run: uv sync --frozen
20-
- name: Test
21-
# use script to provide a tty (workaround of systematic "docker -t"?)
22-
shell: 'script -q -e -c "bash {0}"'
23-
run: |
24-
uv run ./test/test.sh
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: true # required for git lfs
18+
- uses: ./.github/actions/uv-setup/
19+
- name: Test
20+
# use script to provide a tty (workaround of systematic "docker -t"?)
21+
shell: 'script -q -e -c "bash {0}"'
22+
run: |
23+
./test/test.sh

src/xcp_ng_dev/cli.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
import argparse
1212
import os
13-
import subprocess
1413
import shutil
14+
import subprocess
1515
import sys
16+
1617
import argcomplete
1718

1819
CONTAINER_PREFIX = "ghcr.io/xcp-ng/xcp-ng-build-env"
@@ -33,9 +34,7 @@
3334
def is_podman(runner):
3435
if os.path.basename(runner) == "podman":
3536
return True
36-
if subprocess.getoutput(f"{runner} --version").startswith("podman "):
37-
return True
38-
return False
37+
return subprocess.getoutput(f"{runner} --version").startswith("podman ")
3938

4039
def add_common_args(parser):
4140
group = parser.add_argument_group("common arguments")
@@ -139,7 +138,7 @@ def buildparser():
139138
help='Drop a shell into the prepared container')
140139
add_common_args(parser_shell)
141140
add_container_args(parser_shell)
142-
group_shell = parser_run.add_argument_group("shell arguments")
141+
parser_run.add_argument_group("shell arguments")
143142

144143
return parser
145144

0 commit comments

Comments
 (0)