edge-containers-cli 4.3.1__tar.gz → 4.4.1b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.copier-answers.yml +1 -1
- edge_containers_cli-4.4.1b1/.dockerignore +4 -0
- edge_containers_cli-4.4.1b1/.github/workflows/_container.yml +60 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/ci.yml +8 -0
- edge_containers_cli-4.4.1b1/Dockerfile +41 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/PKG-INFO +3 -2
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/pyproject.toml +1 -1
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/__main__.py +28 -20
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/_version.py +2 -2
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/autocomplete.py +4 -1
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/backend.py +3 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cli.py +93 -32
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/argo_commands.py +72 -12
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/commands.py +44 -3
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/helm.py +9 -2
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/k8s_commands.py +14 -6
- edge_containers_cli-4.4.1b1/src/edge_containers_cli/git.py +236 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/utils.py +62 -16
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli.egg-info/PKG-INFO +3 -2
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli.egg-info/SOURCES.txt +2 -0
- edge_containers_cli-4.4.1b1/src/edge_containers_cli.egg-info/entry_points.txt +2 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/conftest.py +4 -1
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/argocd.yaml +65 -0
- edge_containers_cli-4.4.1b1/tests/data/cli.yaml +50 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/k8s.yaml +19 -2
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/yaml.yaml +1 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/test_argocd.py +15 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/test_cli.py +4 -4
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/test_k8s.py +1 -1
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/test_unit.py +21 -3
- edge_containers_cli-4.3.1/Dockerfile +0 -13
- edge_containers_cli-4.3.1/src/edge_containers_cli/git.py +0 -182
- edge_containers_cli-4.3.1/src/edge_containers_cli.egg-info/entry_points.txt +0 -2
- edge_containers_cli-4.3.1/tests/data/cli.yaml +0 -24
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.devcontainer/devcontainer.json +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/CONTRIBUTING.md +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/ISSUE_TEMPLATE/issue.md +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/actions/install_requirements/action.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/dependabot.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/pages/index.html +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/pages/make_switcher.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/_check.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/_dist.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/_pypi.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/_release.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/_test.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.github/workflows/_tox.yml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.gitignore +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.pre-commit-config.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.vscode/extensions.json +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.vscode/launch.json +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.vscode/settings.json +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/.vscode/tasks.json +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/LICENSE +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/README.md +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/conf.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/explanations/decisions/0001-record-architecture-decisions.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/explanations/decisions/0002-switched-to-pip-skeleton.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/explanations/decisions.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/build-docs.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/contribute.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/lint.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/make-release.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/pin-requirements.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/run-tests.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/static-analysis.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/test-container.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/how-to/update-tools.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/index.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/reference/standards.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/developer/tutorials/dev-install.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/genindex.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/images/dls-favicon.ico +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/images/dls-logo.svg +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/images/ec-logs.png +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/images/ec-web.png +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/index.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/user/explanations/docs-structure.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/user/how-to/run-container.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/user/index.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/user/reference/api.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/docs/user/tutorials/installation.rst +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/setup.cfg +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/__init__.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/__init__.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/demo_commands.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/monitor.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/cmds/monitor.tcss +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/definitions.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/globals.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/logging.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/shell.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli.egg-info/dependency_links.txt +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli.egg-info/requires.txt +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli.egg-info/top_level.txt +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/__init__.py +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-deployment/apps/values.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-01/Chart.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-01/config/ioc.db +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-01/config/ioc.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-01/templates/configmap.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-01/values.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-02/Chart.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/bl01t-ea-test-02/values.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/dls-aravis/Chart.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/dls-aravis/config/ioc.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/dls-aravis/templates/configmap.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/dls-aravis/values.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/data/bl01t-services/services/values.yaml +0 -0
- {edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/tests/test_demo.py +0 -0
|
@@ -5,7 +5,7 @@ author_email: giles.knap@gmail.com
|
|
|
5
5
|
author_name: Giles Knap
|
|
6
6
|
description: CLI for deploying and managing epics containers IOCs and services
|
|
7
7
|
distribution_name: edge-containers-cli
|
|
8
|
-
docker:
|
|
8
|
+
docker: true
|
|
9
9
|
docs_type: README
|
|
10
10
|
git_platform: github.com
|
|
11
11
|
github_org: epics-containers
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
on:
|
|
2
|
+
workflow_call:
|
|
3
|
+
|
|
4
|
+
jobs:
|
|
5
|
+
build:
|
|
6
|
+
runs-on: ubuntu-latest
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
- name: Checkout
|
|
10
|
+
uses: actions/checkout@v4
|
|
11
|
+
with:
|
|
12
|
+
# Need this to get version number from last tag
|
|
13
|
+
fetch-depth: 0
|
|
14
|
+
|
|
15
|
+
- name: Set up Docker Buildx
|
|
16
|
+
id: buildx
|
|
17
|
+
uses: docker/setup-buildx-action@v3
|
|
18
|
+
|
|
19
|
+
- name: Log in to GitHub Docker Registry
|
|
20
|
+
if: github.event_name != 'pull_request'
|
|
21
|
+
uses: docker/login-action@v3
|
|
22
|
+
with:
|
|
23
|
+
registry: ghcr.io
|
|
24
|
+
username: ${{ github.actor }}
|
|
25
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
26
|
+
|
|
27
|
+
- name: Build and export to Docker local cache
|
|
28
|
+
uses: docker/build-push-action@v6
|
|
29
|
+
env:
|
|
30
|
+
DOCKER_BUILD_RECORD_UPLOAD: false
|
|
31
|
+
with:
|
|
32
|
+
context: .
|
|
33
|
+
# Need load and tags so we can test it below
|
|
34
|
+
load: true
|
|
35
|
+
tags: tag_for_testing
|
|
36
|
+
|
|
37
|
+
- name: Test cli works in cached runtime image
|
|
38
|
+
run: docker run --rm tag_for_testing --version
|
|
39
|
+
|
|
40
|
+
- name: Create tags for publishing image
|
|
41
|
+
id: meta
|
|
42
|
+
uses: docker/metadata-action@v5
|
|
43
|
+
with:
|
|
44
|
+
images: ghcr.io/${{ github.repository }}
|
|
45
|
+
tags: |
|
|
46
|
+
type=ref,event=tag
|
|
47
|
+
type=raw,value=latest
|
|
48
|
+
|
|
49
|
+
- name: Push cached image to container registry
|
|
50
|
+
if: github.ref_type == 'tag'
|
|
51
|
+
uses: docker/build-push-action@v6
|
|
52
|
+
env:
|
|
53
|
+
DOCKER_BUILD_RECORD_UPLOAD: false
|
|
54
|
+
# This does not build the image again, it will find the image in the
|
|
55
|
+
# Docker cache and publish it
|
|
56
|
+
with:
|
|
57
|
+
context: .
|
|
58
|
+
push: true
|
|
59
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
60
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
@@ -34,6 +34,14 @@ jobs:
|
|
|
34
34
|
secrets:
|
|
35
35
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
36
36
|
|
|
37
|
+
container:
|
|
38
|
+
needs: check
|
|
39
|
+
if: needs.check.outputs.branch-pr == ''
|
|
40
|
+
uses: ./.github/workflows/_container.yml
|
|
41
|
+
permissions:
|
|
42
|
+
contents: read
|
|
43
|
+
packages: write
|
|
44
|
+
|
|
37
45
|
dist:
|
|
38
46
|
needs: check
|
|
39
47
|
if: needs.check.outputs.branch-pr == ''
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# The devcontainer should use the developer target and run as root with podman
|
|
2
|
+
# or docker with user namespaces.
|
|
3
|
+
ARG PYTHON_VERSION=3.12
|
|
4
|
+
FROM python:${PYTHON_VERSION} AS developer
|
|
5
|
+
|
|
6
|
+
# Set up a virtual environment and put it in PATH
|
|
7
|
+
RUN python -m venv /venv
|
|
8
|
+
ENV PATH=/venv/bin:$PATH
|
|
9
|
+
|
|
10
|
+
# install tools used by ec #####################################################
|
|
11
|
+
|
|
12
|
+
# ArgoCD CLI - see https://github.com/argoproj/argo-cd/releases
|
|
13
|
+
RUN VERSION=v2.14.10 && \
|
|
14
|
+
curl -sSL -o argocd https://github.com/argoproj/argo-cd/releases/download/$VERSION/argocd-linux-amd64 && \
|
|
15
|
+
echo "d1750274a336f0a090abf196a832cee14cb9f1c2fc3d20d80b0dbfeff83550fa argocd" | sha256sum -c && \
|
|
16
|
+
install -m 555 argocd /usr/local/bin/argocd && \
|
|
17
|
+
rm argocd
|
|
18
|
+
|
|
19
|
+
# kubectl - see https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/
|
|
20
|
+
RUN VERSION=v1.32.3 && \
|
|
21
|
+
curl -sSLO https://dl.k8s.io/release/$VERSION/bin/linux/amd64/kubectl && \
|
|
22
|
+
echo "ab209d0c5134b61486a0486585604a616a5bb2fc07df46d304b3c95817b2d79f kubectl" | sha256sum -c && \
|
|
23
|
+
install -m 555 kubectl /usr/local/bin/kubectl && \
|
|
24
|
+
rm kubectl
|
|
25
|
+
|
|
26
|
+
# helm - see https://github.com/helm/helm/releases
|
|
27
|
+
RUN VERSION=v3.17.3 && \
|
|
28
|
+
curl -sSL -o helm.tar.gz https://get.helm.sh/helm-$VERSION-linux-amd64.tar.gz && \
|
|
29
|
+
echo "ee88b3c851ae6466a3de507f7be73fe94d54cbf2987cbaa3d1a3832ea331f2cd helm.tar.gz" | sha256sum -c && \
|
|
30
|
+
tar -xzf helm.tar.gz --strip-components=1 linux-amd64/helm && \
|
|
31
|
+
install -m 555 helm /usr/local/bin/helm && \
|
|
32
|
+
rm helm.tar.gz
|
|
33
|
+
|
|
34
|
+
# install the context into the venv
|
|
35
|
+
COPY . /context
|
|
36
|
+
WORKDIR /context
|
|
37
|
+
RUN touch dev-requirements.txt && \
|
|
38
|
+
pip install -c dev-requirements.txt .
|
|
39
|
+
|
|
40
|
+
ENTRYPOINT ["ec"]
|
|
41
|
+
CMD ["--version"]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: edge-containers-cli
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4.1b1
|
|
4
4
|
Summary: CLI for deploying and managing epics containers IOCs and services
|
|
5
5
|
Author-email: Giles Knap <giles.knap@gmail.com>
|
|
6
6
|
License: Apache License
|
|
@@ -232,6 +232,7 @@ Requires-Dist: pytest-mock; extra == "dev"
|
|
|
232
232
|
Requires-Dist: ruff; extra == "dev"
|
|
233
233
|
Requires-Dist: tox-direct; extra == "dev"
|
|
234
234
|
Requires-Dist: types-mock; extra == "dev"
|
|
235
|
+
Dynamic: license-file
|
|
235
236
|
|
|
236
237
|
[](https://github.com/epics-containers/edge-containers-cli/actions/workflows/ci.yml)
|
|
237
238
|
[](https://codecov.io/gh/epics-containers/edge-containers-cli)
|
{edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/__main__.py
RENAMED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
1
3
|
from typing import Optional
|
|
2
4
|
|
|
3
5
|
import typer
|
|
4
6
|
|
|
5
|
-
from edge_containers_cli.cli import cli
|
|
7
|
+
from edge_containers_cli.cli import cli, drop_methods, drop_options, set_optional
|
|
6
8
|
from edge_containers_cli.definitions import ENV, ECBackends, ECContext, ECLogLevels
|
|
7
9
|
|
|
8
10
|
from . import __version__
|
|
@@ -14,6 +16,8 @@ from .utils import init_cleanup
|
|
|
14
16
|
|
|
15
17
|
__all__ = ["main"]
|
|
16
18
|
|
|
19
|
+
DEFAULT_BACKEND = ECBackends.ARGOCD
|
|
20
|
+
|
|
17
21
|
|
|
18
22
|
def version_callback(value: bool):
|
|
19
23
|
if value:
|
|
@@ -23,27 +27,14 @@ def version_callback(value: bool):
|
|
|
23
27
|
|
|
24
28
|
def backend_callback(ctx: typer.Context, backend: ECBackends):
|
|
25
29
|
init_backend(backend)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
mthd.replace("_", "-") for mthd in ec_backend.get_notimplemented_cmds()
|
|
30
|
-
]
|
|
31
|
-
typer_commands = ctx.command.commands # type: ignore
|
|
32
|
-
for command in not_implemented:
|
|
33
|
-
if command in typer_commands:
|
|
34
|
-
typer_commands.pop(command)
|
|
35
|
-
|
|
36
|
-
# Dynamically drop any cli options as specified
|
|
37
|
-
for cmd_name, drop_params in ec_backend.get_notimplemented_params().items():
|
|
38
|
-
for index, param in enumerate(typer_commands[cmd_name].params):
|
|
39
|
-
if param.name in drop_params:
|
|
40
|
-
typer_commands[cmd_name].params.pop(index)
|
|
41
|
-
|
|
30
|
+
drop_methods(ctx, ec_backend.get_notimplemented_cmds())
|
|
31
|
+
drop_options(ctx, ec_backend.get_notimplemented_params())
|
|
32
|
+
set_optional(ctx, ec_backend.get_optional_params())
|
|
42
33
|
return backend.value
|
|
43
34
|
|
|
44
35
|
|
|
45
36
|
@cli.callback()
|
|
46
|
-
def
|
|
37
|
+
def _main(
|
|
47
38
|
ctx: typer.Context,
|
|
48
39
|
version: Optional[bool] = typer.Option(
|
|
49
40
|
None,
|
|
@@ -67,7 +58,7 @@ def main(
|
|
|
67
58
|
envvar=ENV.target.value,
|
|
68
59
|
),
|
|
69
60
|
backend: ECBackends = typer.Option(
|
|
70
|
-
|
|
61
|
+
DEFAULT_BACKEND,
|
|
71
62
|
"-b",
|
|
72
63
|
"--backend",
|
|
73
64
|
callback=backend_callback,
|
|
@@ -123,7 +114,24 @@ def main(
|
|
|
123
114
|
ec_backend.set_context(context)
|
|
124
115
|
|
|
125
116
|
|
|
117
|
+
def force_backend_callback():
|
|
118
|
+
"""
|
|
119
|
+
Typer does not execute option callbacks before running --help unless the
|
|
120
|
+
option is explicitly provided
|
|
121
|
+
"""
|
|
122
|
+
if "--help" in sys.argv:
|
|
123
|
+
if "-b" not in sys.argv:
|
|
124
|
+
backend = os.environ.get("EC_CLI_BACKEND", DEFAULT_BACKEND)
|
|
125
|
+
sys.argv.insert(1, backend)
|
|
126
|
+
sys.argv.insert(1, "-b")
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def main():
|
|
130
|
+
force_backend_callback()
|
|
131
|
+
cli()
|
|
132
|
+
|
|
133
|
+
|
|
126
134
|
# test with:
|
|
127
135
|
# python -m edge_containers_cli
|
|
128
136
|
if __name__ == "__main__":
|
|
129
|
-
|
|
137
|
+
main()
|
{edge_containers_cli-4.3.1 → edge_containers_cli-4.4.1b1}/src/edge_containers_cli/autocomplete.py
RENAMED
|
@@ -33,7 +33,10 @@ def fetch_service_graph(repo: str) -> dict:
|
|
|
33
33
|
if not version_map:
|
|
34
34
|
with new_workdir() as path:
|
|
35
35
|
version_map = create_version_map(
|
|
36
|
-
repo,
|
|
36
|
+
repo,
|
|
37
|
+
Path(globals.SERVICES_DIR),
|
|
38
|
+
path,
|
|
39
|
+
shared_files=[globals.SHARED_VALUES],
|
|
37
40
|
)
|
|
38
41
|
cache_dict(
|
|
39
42
|
globals.CACHE_ROOT / url_encode(repo),
|
|
@@ -40,7 +40,10 @@ cli = ErrorHandlingTyper(pretty_exceptions_show_locals=False)
|
|
|
40
40
|
@cli.command()
|
|
41
41
|
def attach(
|
|
42
42
|
service_name: str = typer.Argument(
|
|
43
|
-
...,
|
|
43
|
+
...,
|
|
44
|
+
help="Name of the service to attach to",
|
|
45
|
+
autocompletion=running_svc,
|
|
46
|
+
show_default=False,
|
|
44
47
|
),
|
|
45
48
|
):
|
|
46
49
|
"""
|
|
@@ -52,15 +55,18 @@ def attach(
|
|
|
52
55
|
@cli.command()
|
|
53
56
|
def delete(
|
|
54
57
|
service_name: str = typer.Argument(
|
|
55
|
-
...,
|
|
58
|
+
...,
|
|
59
|
+
help="Name of the service to delete",
|
|
60
|
+
autocompletion=all_svc,
|
|
61
|
+
show_default=False,
|
|
56
62
|
),
|
|
57
63
|
yes: bool = typer.Option(False, "-y", "--yes", help="Skip confirmation prompt"),
|
|
58
64
|
):
|
|
59
65
|
"""
|
|
60
|
-
Remove a
|
|
66
|
+
Remove a service from the cluster
|
|
61
67
|
"""
|
|
62
68
|
confirmation(
|
|
63
|
-
f"Remove
|
|
69
|
+
f"Remove {service_name} from the target `{backend.commands.target}`",
|
|
64
70
|
yes,
|
|
65
71
|
)
|
|
66
72
|
backend.commands.delete(service_name)
|
|
@@ -69,12 +75,16 @@ def delete(
|
|
|
69
75
|
@cli.command()
|
|
70
76
|
def deploy(
|
|
71
77
|
service_name: str = typer.Argument(
|
|
72
|
-
...,
|
|
78
|
+
...,
|
|
79
|
+
help="Name of the service to deploy",
|
|
80
|
+
autocompletion=avail_services,
|
|
81
|
+
show_default=False,
|
|
73
82
|
),
|
|
74
83
|
version: str = typer.Argument(
|
|
75
|
-
|
|
76
|
-
help="Version tag of the service to deploy",
|
|
84
|
+
"latest tag",
|
|
85
|
+
help="Version tag or branch of the service to deploy",
|
|
77
86
|
autocompletion=avail_versions,
|
|
87
|
+
show_default=False,
|
|
78
88
|
),
|
|
79
89
|
wait: bool = typer.Option(False, "--wait", help="Waits for readiness"),
|
|
80
90
|
yes: bool = typer.Option(False, "-y", "--yes", help="Skip confirmation prompt"),
|
|
@@ -83,15 +93,19 @@ def deploy(
|
|
|
83
93
|
),
|
|
84
94
|
):
|
|
85
95
|
"""
|
|
86
|
-
|
|
96
|
+
Add a service to the cluster from its source repository
|
|
87
97
|
"""
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
|
|
99
|
+
def confirm_callback(svc_version):
|
|
100
|
+
confirmation(
|
|
101
|
+
f"Deploy {service_name.lower()} "
|
|
102
|
+
f"of version `{svc_version}` to target `{backend.commands.target}`",
|
|
103
|
+
yes,
|
|
104
|
+
)
|
|
105
|
+
|
|
93
106
|
args = args if not wait else args + " --wait"
|
|
94
|
-
|
|
107
|
+
version = version if version != "latest tag" else ""
|
|
108
|
+
backend.commands.deploy(service_name, version, args, confirm_callback)
|
|
95
109
|
|
|
96
110
|
|
|
97
111
|
@cli.command()
|
|
@@ -103,19 +117,23 @@ def deploy_local(
|
|
|
103
117
|
file_okay=False,
|
|
104
118
|
resolve_path=True,
|
|
105
119
|
autocompletion=force_plain_completion,
|
|
120
|
+
show_default=False,
|
|
106
121
|
),
|
|
107
122
|
yes: bool = typer.Option(False, "-y", "--yes", help="Skip confirmation prompt"),
|
|
108
123
|
args: str = typer.Option("", help="Additional args for helm, 'must be quoted'"),
|
|
109
124
|
):
|
|
110
125
|
"""
|
|
111
|
-
|
|
126
|
+
Add a local service helm chart directly to the cluster with dated beta version
|
|
112
127
|
"""
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
|
|
129
|
+
def confirm_callback(svc_version):
|
|
130
|
+
confirmation(
|
|
131
|
+
f"Deploy local {svc_instance.name.lower()} of version `{svc_version}` "
|
|
132
|
+
f"from {svc_instance} to target `{backend.commands.target}`",
|
|
133
|
+
yes,
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
backend.commands.deploy_local(svc_instance, args, confirm_callback)
|
|
119
137
|
|
|
120
138
|
|
|
121
139
|
@cli.command()
|
|
@@ -131,6 +149,7 @@ def exec(
|
|
|
131
149
|
...,
|
|
132
150
|
help="Name of the service container to run in",
|
|
133
151
|
autocompletion=running_svc,
|
|
152
|
+
show_default=False,
|
|
134
153
|
),
|
|
135
154
|
):
|
|
136
155
|
"""Execute a bash prompt in a running container"""
|
|
@@ -140,7 +159,10 @@ def exec(
|
|
|
140
159
|
@cli.command()
|
|
141
160
|
def instances(
|
|
142
161
|
service_name: str = typer.Argument(
|
|
143
|
-
...,
|
|
162
|
+
...,
|
|
163
|
+
help="Name of the service to inspect",
|
|
164
|
+
autocompletion=avail_services,
|
|
165
|
+
show_default=False,
|
|
144
166
|
),
|
|
145
167
|
):
|
|
146
168
|
"""List all versions of the specified service in the repository"""
|
|
@@ -149,19 +171,19 @@ def instances(
|
|
|
149
171
|
service_name,
|
|
150
172
|
backend.commands.repo,
|
|
151
173
|
Path(globals.SERVICES_DIR),
|
|
152
|
-
|
|
174
|
+
shared_files=[globals.SHARED_VALUES],
|
|
153
175
|
)
|
|
154
176
|
)
|
|
155
177
|
|
|
156
178
|
|
|
157
|
-
@cli.command()
|
|
158
|
-
def
|
|
179
|
+
@cli.command(name="list")
|
|
180
|
+
def _list():
|
|
159
181
|
"""List all services available in the service repository"""
|
|
160
182
|
print(
|
|
161
183
|
list_all(
|
|
162
184
|
backend.commands.repo,
|
|
163
185
|
Path(globals.SERVICES_DIR),
|
|
164
|
-
|
|
186
|
+
shared_files=[globals.SHARED_VALUES],
|
|
165
187
|
)
|
|
166
188
|
)
|
|
167
189
|
|
|
@@ -172,16 +194,20 @@ def log_history(
|
|
|
172
194
|
...,
|
|
173
195
|
help="Name of the service to inspect",
|
|
174
196
|
autocompletion=all_svc,
|
|
197
|
+
show_default=False,
|
|
175
198
|
),
|
|
176
199
|
):
|
|
177
|
-
"""Open historical logs for
|
|
200
|
+
"""Open historical logs for a service"""
|
|
178
201
|
backend.commands.log_history(service_name)
|
|
179
202
|
|
|
180
203
|
|
|
181
204
|
@cli.command()
|
|
182
205
|
def logs(
|
|
183
206
|
service_name: str = typer.Argument(
|
|
184
|
-
...,
|
|
207
|
+
...,
|
|
208
|
+
help="Name of the service to inspect",
|
|
209
|
+
autocompletion=running_svc,
|
|
210
|
+
show_default=False,
|
|
185
211
|
),
|
|
186
212
|
prev: bool = typer.Option(
|
|
187
213
|
False,
|
|
@@ -190,7 +216,7 @@ def logs(
|
|
|
190
216
|
help="Show log from the previous instance of the service",
|
|
191
217
|
),
|
|
192
218
|
):
|
|
193
|
-
"""Show logs for current and previous instances of
|
|
219
|
+
"""Show logs for current and previous instances of a service"""
|
|
194
220
|
backend.commands.logs(service_name, prev)
|
|
195
221
|
|
|
196
222
|
|
|
@@ -200,7 +226,7 @@ def monitor(
|
|
|
200
226
|
False, "-r", "--running-only", help="list only services that are running"
|
|
201
227
|
),
|
|
202
228
|
):
|
|
203
|
-
"""Open monitor TUI
|
|
229
|
+
"""Open monitor TUI"""
|
|
204
230
|
from edge_containers_cli.cmds.monitor import (
|
|
205
231
|
MonitorApp, # Lazy import for performace
|
|
206
232
|
)
|
|
@@ -222,7 +248,10 @@ def ps(
|
|
|
222
248
|
@cli.command()
|
|
223
249
|
def restart(
|
|
224
250
|
service_name: str = typer.Argument(
|
|
225
|
-
...,
|
|
251
|
+
...,
|
|
252
|
+
help="Name of the container to restart",
|
|
253
|
+
autocompletion=running_svc,
|
|
254
|
+
show_default=False,
|
|
226
255
|
),
|
|
227
256
|
):
|
|
228
257
|
"""Restart a service"""
|
|
@@ -232,7 +261,10 @@ def restart(
|
|
|
232
261
|
@cli.command()
|
|
233
262
|
def start(
|
|
234
263
|
service_name: str = typer.Argument(
|
|
235
|
-
...,
|
|
264
|
+
...,
|
|
265
|
+
help="Name of the service container to start",
|
|
266
|
+
autocompletion=all_svc,
|
|
267
|
+
show_default=False,
|
|
236
268
|
),
|
|
237
269
|
commit: bool = typer.Option(False, help="Commits the values to the git repo"),
|
|
238
270
|
):
|
|
@@ -250,6 +282,7 @@ def stop(
|
|
|
250
282
|
...,
|
|
251
283
|
help="Name of the service container to stop",
|
|
252
284
|
autocompletion=running_svc,
|
|
285
|
+
show_default=False,
|
|
253
286
|
),
|
|
254
287
|
commit: bool = typer.Option(False, help="Commits the values to the git repo"),
|
|
255
288
|
):
|
|
@@ -270,6 +303,7 @@ def template(
|
|
|
270
303
|
file_okay=False,
|
|
271
304
|
resolve_path=True,
|
|
272
305
|
autocompletion=force_plain_completion,
|
|
306
|
+
show_default=False,
|
|
273
307
|
),
|
|
274
308
|
args: str = typer.Option("", help="Additional args for helm, 'must be quoted'"),
|
|
275
309
|
):
|
|
@@ -278,3 +312,30 @@ def template(
|
|
|
278
312
|
"""
|
|
279
313
|
args = f"{args} --debug"
|
|
280
314
|
backend.commands.template(svc_instance, args)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def drop_methods(ctx: typer.Context, to_drop: list[str]):
|
|
318
|
+
"""Dynamically drop any method not implemented"""
|
|
319
|
+
not_implemented = [mthd.replace("_", "-") for mthd in to_drop]
|
|
320
|
+
typer_commands = ctx.command.commands # type: ignore
|
|
321
|
+
for command in not_implemented:
|
|
322
|
+
if command in typer_commands:
|
|
323
|
+
typer_commands.pop(command)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def drop_options(ctx: typer.Context, to_drop: dict[str, list[str]]):
|
|
327
|
+
"""Dynamically drop any cli options as specified"""
|
|
328
|
+
typer_commands = ctx.command.commands # type: ignore
|
|
329
|
+
for cmd_name, drop_params in to_drop.items():
|
|
330
|
+
for i, param in enumerate(typer_commands[cmd_name].params):
|
|
331
|
+
if param.name in drop_params:
|
|
332
|
+
typer_commands[cmd_name].params.pop(i)
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
def set_optional(ctx: typer.Context, to_set: dict[str, list[str]]):
|
|
336
|
+
"""Dynamically set any cli options optional as specified"""
|
|
337
|
+
typer_commands = ctx.command.commands # type: ignore
|
|
338
|
+
for cmd_name, optional_params in to_set.items():
|
|
339
|
+
for i, param in enumerate(typer_commands[cmd_name].params):
|
|
340
|
+
if param.name in optional_params:
|
|
341
|
+
typer_commands[cmd_name].params[i].required = False
|