Skip to content

Commit

Permalink
Merge pull request #606 from linode/dev
Browse files Browse the repository at this point in the history
Release v5.49.0
  • Loading branch information
ykim-akamai authored May 1, 2024
2 parents 592ddb3 + 77b7e8c commit a636df9
Show file tree
Hide file tree
Showing 70 changed files with 3,572 additions and 1,533 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
attributes:
label: CLI Version
description: What version of linode-cli are you running? `linode-cli -v`
placeholder: linode-cli 5.24.0 Built off spec version 4.138.0
placeholder: linode-cli 5.24.0 Built from spec version 4.138.0
validations:
required: true
- type: textarea
Expand Down
14 changes: 14 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PR Labels
- name: new-feature
description: for new features in the changelog.
color: 225fee
Expand All @@ -13,6 +14,9 @@
- name: documentation
description: for updates to the documentation in the changelog.
color: d3e1e6
- name: dependencies
description: dependency updates usually from dependabot
color: 5c9dff
- name: testing
description: for updates to the testing suite in the changelog.
color: 933ac9
Expand All @@ -22,3 +26,13 @@
- name: ignore-for-release
description: PRs you do not want to render in the changelog
color: 7b8eac
- name: do-not-merge
description: PRs that should not be merged until the commented issue is resolved
color: eb1515
# Issue Labels
- name: enhancement
description: issues that request a enhancement
color: 22ee47
- name: bug
description: issues that report a bug
color: ed8e21
4 changes: 2 additions & 2 deletions .github/workflows/e2e-suite-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
python-version: '3.x'

- name: Install Python deps
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
run: pip install .[dev,obj]

- name: Install the CLI
run: make install
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
python-version: '3.x'

- name: Install Python deps
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
run: pip install .[obj,dev]

- name: Install the CLI
run: make install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: pip install certifi -U

- name: Install deps
run: pip install -r requirements.txt -r requirements-dev.txt
run: pip install .[obj,dev]

- name: Install Package
run: make install
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: labeler

on:
push:
branches:
- 'main'
paths:
- '.github/labels.yml'
- '.github/workflows/labeler.yml'
pull_request:
paths:
- '.github/labels.yml'
- '.github/workflows/labeler.yml'

jobs:
labeler:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Run Labeler
uses: crazy-max/ghaction-github-labeler@de749cf181958193cb7debf1a9c5bb28922f3e1b
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
dry-run: ${{ github.event_name == 'pull_request' }}
exclude: |
help*
*issue
2 changes: 1 addition & 1 deletion .github/workflows/nightly-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python-version: '3.x'

- name: Install Python deps
run: pip install -r requirements.txt -r requirements-dev.txt wheel boto3
run: pip install .[obj,dev]

- name: Install Linode CLI
run: make install
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ jobs:
# This is necessary as we want to ensure that version tags
# are properly formatted before passing them into the
# DockerFile.
- name: Get CLI version
run: |
export CLI_VERSION=$(./version)
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_OUTPUT
env:
LINODE_CLI_VERSION: ${{ github.event.release.tag_name }}
- uses: actions/github-script@v7
id: cli_version
with:
script: |
let tag_name = '${{ github.event.release.tag_name }}';
if (tag_name.startsWith("v")) {
tag_name = tag_name.slice(1);
}
return tag_name;
result-encoding: string

- name: Build and push to DockerHub
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # [email protected]
Expand All @@ -49,7 +54,7 @@ jobs:
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: linode/cli:${{ steps.cli_version.outputs.CLI_VERSION }},linode/cli:latest
tags: linode/cli:${{ steps.cli_version.outputs.result }},linode/cli:latest
build-args: |
linode_cli_version=${{ steps.cli_version.outputs.CLI_VERSION }}
linode_cli_version=${{ steps.cli_version.outputs.result }}
github_token=${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: install boto3
run: pip3 install boto3
- name: install dependencies
run: pip3 install -r requirements-dev.txt -r requirements.txt
run: pip install .[obj,dev]

- name: run linter
run: make lint
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: pip install certifi -U

- name: Install deps
run: pip install -r requirements.txt -r requirements-dev.txt
run: pip install .[dev]

- name: Install Package
run: make install
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
run: pip install certifi -U

- name: Install deps
run: pip install -r requirements.txt -r requirements-dev.txt
run: pip install .[dev]

- name: Install Package
shell: pwsh
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
linode-cli
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ ARG github_token

WORKDIR /src

COPY requirements.txt .

RUN apt-get update && \
apt-get install -y make git && \
pip3 install -r requirements.txt && \
pip3 install build
apt-get install -y make git

COPY . .

RUN make requirements

RUN LINODE_CLI_VERSION=$linode_cli_version GITHUB_TOKEN=$github_token make build

FROM python:3.11-slim
Expand Down
4 changes: 0 additions & 4 deletions Jenkinsfile

This file was deleted.

3 changes: 0 additions & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
include linodecli/data-3
include linodecli/oauth-landing-page.html
include linode-cli.sh
include baked_version
include requirements.txt
19 changes: 14 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Makefile for more convenient building of the Linode CLI and its baked content
#
INTEGRATION_TEST_PATH :=
MODULE :=
TEST_CASE_COMMAND :=

ifdef TEST_CASE
Expand All @@ -14,6 +14,11 @@ ifndef SPEC
override SPEC = $(shell ./resolve_spec_url ${SPEC_VERSION})
endif

# Version-related variables
VERSION_FILE := ./linodecli/version.py
VERSION_MODULE_DOCSTRING ?= \"\"\"\nThe version of the Linode CLI.\n\"\"\"\n\n
LINODE_CLI_VERSION ?= "0.0.0.dev"

.PHONY: install
install: check-prerequisites requirements build
pip3 install --force dist/*.whl
Expand All @@ -27,13 +32,17 @@ else
cp data-3 linodecli/
endif

.PHONY: create-version
create-version:
@printf "${VERSION_MODULE_DOCSTRING}__version__ = \"${LINODE_CLI_VERSION}\"\n" > $(VERSION_FILE)

.PHONY: build
build: clean bake
build: clean create-version bake
python3 -m build --wheel --sdist

.PHONY: requirements
requirements:
pip3 install -r requirements.txt -r requirements-dev.txt
pip3 install --upgrade .[dev,obj]

.PHONY: lint
lint: build
Expand Down Expand Up @@ -62,7 +71,7 @@ testunit:

.PHONY: testint
testint:
pytest tests/integration/${INTEGRATION_TEST_PATH} ${TEST_CASE_COMMAND} --disable-warnings
pytest tests/integration/${MODULE} ${TEST_CASE_COMMAND}

.PHONY: testall
testall:
Expand All @@ -89,4 +98,4 @@ format: black isort autoflake

@PHONEY: smoketest
smoketest:
pytest -m smoke tests/integration --disable-warnings
pytest -m smoke tests/integration
23 changes: 7 additions & 16 deletions linodecli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,20 @@
from linodecli import plugins

from .arg_helpers import (
action_help,
bake_command,
help_with_ops,
register_args,
register_plugin,
remove_plugin,
)
from .cli import CLI
from .completion import bake_completions, get_completions
from .completion import get_completions
from .configuration import ENV_TOKEN_NAME
from .help_pages import print_help_action, print_help_default
from .helpers import handle_url_overrides
from .output import OutputMode
from .version import __version__

# this might not be installed at the time of building
try:
VERSION = version("linode-cli")
except:
VERSION = "building"
VERSION = __version__

BASE_URL = "https://api.linode.com/v4"

Expand Down Expand Up @@ -113,7 +109,7 @@ def main(): # pylint: disable=too-many-branches,too-many-statements
if not parsed.command:
# print version info and exit - but only if no command was given
print(f"linode-cli {VERSION}")
print(f"Built off spec version {cli.spec_version}")
print(f"Built from spec version {cli.spec_version}")
sys.exit(0)
else:
# something else might want to parse version
Expand Down Expand Up @@ -155,7 +151,7 @@ def main(): # pylint: disable=too-many-branches,too-many-statements
# handle a help for the CLI
if parsed.command is None or (parsed.command is None and parsed.help):
parser.print_help()
help_with_ops(cli.ops, cli.config)
print_help_default(cli.ops, cli.config)
sys.exit(0)

# configure
Expand Down Expand Up @@ -209,11 +205,6 @@ def main(): # pylint: disable=too-many-branches,too-many-statements
cli.config.remove_user(parsed.action)
sys.exit(0)

# special command to bake shell completion script
if parsed.command == "bake-bash":
bake_completions(cli.ops)
sys.exit(0)

# check for plugin invocation
if parsed.command not in cli.ops and parsed.command in plugins.available(
cli.config
Expand Down Expand Up @@ -257,6 +248,6 @@ def main(): # pylint: disable=too-many-branches,too-many-statements

if parsed.command is not None and parsed.action is not None:
if parsed.help:
action_help(cli, parsed.command, parsed.action)
print_help_action(cli, parsed.command, parsed.action)
sys.exit(0)
cli.handle_command(parsed.command, parsed.action, args)
Loading

0 comments on commit a636df9

Please sign in to comment.