Skip to content

Commit 5f3e3d4

Browse files
Merge pull request #498 from linode/dev
v5.41.3
2 parents ac7377e + 26031bd commit 5f3e3d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+272
-151
lines changed

.github/workflows/docker-build.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Docker Image Build CI
2+
3+
on:
4+
push:
5+
branches: [ "dev", "main" ]
6+
pull_request:
7+
branches: [ "dev", "main" ]
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Build the Docker image
18+
run: docker build . --file Dockerfile --tag linode/cli:$(date +%s) --build-arg="github_token=$GITHUB_TOKEN"
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Nightly Smoke Tests
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
smoke_tests:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
with:
16+
ref: dev
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Install Python deps
24+
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
25+
26+
- name: Install Linode CLI
27+
run: make install
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Run smoke tests
32+
run: |
33+
make smoketest
34+
env:
35+
LINODE_CLI_TOKEN: ${{ secrets.LINODE_TOKEN_2 }}

.github/workflows/oci-build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ jobs:
1717
python-version: '3.x'
1818

1919
- name: Set up QEMU
20-
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # pin@v2
20+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # pin@v2.2.0
2121

2222
- name: Set up Docker Buildx
23-
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # pin@v2
23+
uses: docker/setup-buildx-action@ecf95283f03858871ff00b787d79c419715afc34 # pin@v2.7.0
2424

2525
- name: Login to Docker Hub
26-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # pin@v2
26+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # pin@v2.2.0
2727
with:
2828
username: ${{ secrets.DOCKERHUB_USERNAME }}
2929
password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -40,10 +40,10 @@ jobs:
4040
id: cli_version
4141

4242
- name: Build and push to DockerHub
43-
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # pin@v3
43+
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # pin@v4.1.1
4444
with:
4545
context: .
46-
file: Dockerfile-release
46+
file: Dockerfile
4747
platforms: linux/amd64,linux/arm64
4848
push: true
4949
tags: linode/cli:${{ steps.cli_version.outputs.CLI_VERSION }},linode/cli:latest

.github/workflows/publish-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ jobs:
3434
LINODE_CLI_VERSION: ${{ github.event.release.tag_name }}
3535

3636
- name: Publish the release artifacts to PyPI
37-
uses: pypa/gh-action-pypi-publish@37f50c210e3d2f9450da2cd423303d6a14a6e29f # pin@release/v1
37+
uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598 # pin@release/v1.8.6
3838
with:
39-
password: ${{ secrets.PYPI_API_TOKEN }}
39+
password: ${{ secrets.PYPI_API_TOKEN }}

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* @linode/dx
2+

Dockerfile

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
FROM python:2-slim
1+
FROM python:3.11-slim AS builder
22

3-
ENV PYTHONPATH=.
4-
ENV PATH="/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin"
5-
6-
RUN apt-get update && apt-get install -y git python3 python3-pip \
7-
&& rm -rf /var/lib/apt/lists/* \
8-
&& rm -rf /var/cache/apt/*
3+
ARG linode_cli_version
4+
ARG github_token
95

106
WORKDIR /src
117

128
COPY requirements.txt .
139

14-
RUN pip install -r requirements.txt \
15-
&& pip3 install -r requirements.txt \
16-
&& pip install twine
10+
RUN apt-get update && \
11+
apt-get install -y make git && \
12+
pip3 install -r requirements.txt && \
13+
pip3 install build
1714

1815
COPY . .
1916

20-
# Build and Install the Linode CLI
21-
ENTRYPOINT ["make", "build"]
17+
RUN LINODE_CLI_VERSION=$linode_cli_version GITHUB_TOKEN=$github_token make build
18+
19+
FROM python:3.11-slim
20+
21+
COPY --from=builder /src/dist /dist
22+
23+
RUN pip3 install /dist/*.whl boto3
24+
25+
RUN useradd -ms /bin/bash cli
26+
USER cli:cli
27+
28+
ENTRYPOINT ["linode-cli"]

Dockerfile-bats

Lines changed: 0 additions & 51 deletions
This file was deleted.

Dockerfile-release

Lines changed: 0 additions & 27 deletions
This file was deleted.

Makefile

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,27 @@ ifndef SPEC
1414
override SPEC = $(shell ./resolve_spec_url ${SPEC_VERSION})
1515
endif
1616

17+
.PHONY: install
1718
install: check-prerequisites requirements build
1819
pip3 install --force dist/*.whl
1920

2021
.PHONY: build
2122
build: clean
2223
python3 -m linodecli bake ${SPEC} --skip-config
2324
cp data-3 linodecli/
24-
python3 setup.py bdist_wheel
25-
python3 setup.py sdist
25+
python3 -m build --wheel --sdist
2626

2727
.PHONY: requirements
2828
requirements:
29-
pip3 install -r requirements.txt
29+
pip3 install -r requirements.txt -r requirements-dev.txt
3030

31-
.PHONY: requirements
32-
lint:
31+
.PHONY: lint
32+
lint: build
3333
pylint linodecli
3434
isort --check-only linodecli tests
3535
autoflake --check linodecli tests
3636
black --check --verbose linodecli tests
37+
twine check dist/*
3738

3839
.PHONY: check-prerequisites
3940
check-prerequisites:
@@ -64,13 +65,21 @@ testall:
6465
.PHONY: test
6566
test: testunit
6667

68+
.PHONY: black
6769
black:
6870
black linodecli tests
6971

72+
.PHONY: isort
7073
isort:
7174
isort linodecli tests
7275

76+
.PHONY: autoflake
7377
autoflake:
7478
autoflake linodecli tests
7579

80+
.PHONY: format
7681
format: black isort autoflake
82+
83+
@PHONEY: smoketest
84+
smoketest:
85+
pytest -m smoke tests/integration --disable-warnings

linodecli/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ def main(): # pylint: disable=too-many-branches,too-many-statements
6868
cli.output_handler.columns = "*"
6969
elif parsed.markdown:
7070
cli.output_handler.mode = OutputMode.markdown
71+
elif parsed.ascii_table:
72+
cli.output_handler.mode = OutputMode.ascii_table
7173

7274
if parsed.delimiter:
7375
cli.output_handler.delimiter = parsed.delimiter

0 commit comments

Comments
 (0)