Skip to content

Commit e0d0456

Browse files
tarekbadrshafrittoli
authored andcommitted
Update Makefile
1 parent 4b2ef1a commit e0d0456

File tree

15 files changed

+705
-151
lines changed

15 files changed

+705
-151
lines changed

.pylintrc

Lines changed: 570 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include header.mk
22

3-
PACKAGES = template core web cli
3+
PACKAGES = cli
44
export ABS_ROOT_PATH=$(shell pwd)
55

66
.PHONY: packages $(PACKAGES)
@@ -50,13 +50,6 @@ format: $(FORMATPACKAGES)
5050
$(FORMATPACKAGES):
5151
$(MAKE) -C $(@:format-%=%) format
5252

53-
install: ## Installs dependencies from requirements.txt
54-
pip install -r ./requirements
55-
pre-commit install
56-
57-
internal-install: ## Installs VCC-internal dependencies from vcc-requirements.txt
58-
pip install --extra-index-url https://TODO -r vccinternal-requirements.txt
59-
6053
check: ## Runs pre-commit hooks on all files
6154
pre-commit run --all-files
6255

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Python SDK for CDEvents
44

5-
update ...
5+
update ...

cli/cdevents/cli/__main__.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,25 @@
66
import click
77
import yaml
88

9+
from cdevents.cli.artifact import packaged, published
10+
from cdevents.cli.branch import created as branch_created
11+
from cdevents.cli.branch import deleted as branch_deleted
12+
from cdevents.cli.build import finished, queued, started
913
from cdevents.cli.constants import LOGGING_CONFIGURATION_FILE
14+
from cdevents.cli.env import created as env_created
15+
from cdevents.cli.env import deleted as env_deleted
16+
from cdevents.cli.env import modified as env_modified
17+
from cdevents.cli.pipelinerun import finished as pipe_finished
18+
from cdevents.cli.pipelinerun import queued as pipe_queued
19+
from cdevents.cli.pipelinerun import started as pipe_started
20+
from cdevents.cli.service import deployed as service_deployed
21+
from cdevents.cli.service import removed as service_removed
22+
from cdevents.cli.service import rolledback as service_rolledback
23+
from cdevents.cli.service import upgraded as service_upgraded
24+
from cdevents.cli.taskrun import finished as taskrun_finished
25+
from cdevents.cli.taskrun import started as taskrun_started
1026
from cdevents.cli.utils import add_disclaimer_text
1127

12-
from cdevents.cli.build import finished, queued, started
13-
from cdevents.cli.artifact import packaged, published
14-
from cdevents.cli.branch import created as branch_created, deleted as branch_deleted
15-
from cdevents.cli.env import created as env_created, deleted as env_deleted, modified as env_modified
16-
from cdevents.cli.pipelinerun import started as pipe_started, finished as pipe_finished, queued as pipe_queued
17-
from cdevents.cli.service import deployed as service_deployed, upgraded as service_upgraded, removed as service_removed, rolledback as service_rolledback
18-
from cdevents.cli.taskrun import started as taskrun_started, finished as taskrun_finished
19-
2028

2129
def configure_logging():
2230
"""Configures logging from file."""
@@ -29,6 +37,7 @@ def configure_logging():
2937
def build():
3038
"""Click group for command 'build'."""
3139

40+
3241
build.add_command(finished)
3342
build.add_command(queued)
3443
build.add_command(started)
@@ -38,6 +47,7 @@ def build():
3847
def artifact():
3948
"""Click group for command 'artifact'."""
4049

50+
4151
artifact.add_command(packaged)
4252
artifact.add_command(published)
4353

@@ -46,6 +56,7 @@ def artifact():
4656
def branch():
4757
"""Click group for command 'branch'."""
4858

59+
4960
branch.add_command(branch_created)
5061
branch.add_command(branch_deleted)
5162

@@ -54,27 +65,27 @@ def branch():
5465
def env():
5566
"""Click group for command 'environment'."""
5667

68+
5769
env.add_command(env_created)
5870
env.add_command(env_deleted)
5971
env.add_command(env_modified)
6072

6173

62-
63-
6474
@click.group(help=add_disclaimer_text("""Commands PipelineRun related CloudEvent."""))
6575
def pipelinerun():
6676
"""Click group for command 'environment'."""
6777

78+
6879
pipelinerun.add_command(pipe_started)
6980
pipelinerun.add_command(pipe_finished)
7081
pipelinerun.add_command(pipe_queued)
7182

7283

73-
7484
@click.group(help=add_disclaimer_text("""Commands Service related CloudEvent."""))
7585
def service():
7686
"""Click group for command 'service'."""
7787

88+
7889
service.add_command(service_deployed)
7990
service.add_command(service_upgraded)
8091
service.add_command(service_removed)
@@ -85,12 +96,11 @@ def service():
8596
def taskrun():
8697
"""Click group for command 'taskrun'."""
8798

99+
88100
taskrun.add_command(taskrun_started)
89101
taskrun.add_command(taskrun_finished)
90102

91103

92-
93-
94104
@click.group(
95105
help=add_disclaimer_text(
96106
"""Main entry point for cdevents client cli.

cli/cdevents/cli/artifact.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
"""Module for cli artifact commands."""
22
from __future__ import annotations
3-
import os
43

4+
import os
55
from typing import List
66

77
import click
88
import requests
9-
109
from cloudevents.http import CloudEvent, to_structured
1110

12-
from cdevents.cli.utils import (
13-
add_disclaimer_text,
14-
print_function_args,
15-
)
11+
from cdevents.cli.utils import add_disclaimer_text, print_function_args
1612

1713

1814
# pylint: disable=unused-argument
@@ -51,7 +47,7 @@ def common_artifact_options(function):
5147
"--data",
5248
"-d",
5349
required=False,
54-
type=(str,str),
50+
type=(str, str),
5551
multiple=True,
5652
help="Artifact Data.",
5753
)(function)
@@ -66,7 +62,7 @@ def packaged(
6662
id: str,
6763
name: str = None,
6864
version: str = None,
69-
data :List[str] = None,
65+
data: List[str] = None,
7066
):
7167
print_function_args()
7268
attributes = {
@@ -84,14 +80,15 @@ def packaged(
8480
# send and print event
8581
requests.post(cde_sink, headers=headers, data=body)
8682

83+
8784
@click.command(help=add_disclaimer_text("Artifact Published CloudEvent."))
8885
@common_artifact_options
8986
def published(
9087
cde_sink: str,
9188
id: str,
9289
name: str = None,
9390
version: str = None,
94-
data :List[str] = None,
91+
data: List[str] = None,
9592
):
9693
print_function_args()
9794
attributes = {
@@ -107,4 +104,4 @@ def published(
107104
headers, body = to_structured(event)
108105

109106
# send and print event
110-
requests.post(cde_sink, headers=headers, data=body)
107+
requests.post(cde_sink, headers=headers, data=body)

cli/cdevents/cli/branch.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
"""Module for cli branch commands."""
22
from __future__ import annotations
3-
import os
43

4+
import os
55
from typing import List
66

77
import click
88
import requests
9-
109
from cloudevents.http import CloudEvent, to_structured
1110

12-
from cdevents.cli.utils import (
13-
add_disclaimer_text,
14-
print_function_args,
15-
)
11+
from cdevents.cli.utils import add_disclaimer_text, print_function_args
1612

1713

1814
# pylint: disable=unused-argument
@@ -51,7 +47,7 @@ def common_branch_options(function):
5147
"--data",
5248
"-d",
5349
required=False,
54-
type=(str,str),
50+
type=(str, str),
5551
multiple=True,
5652
help="Branch Data.",
5753
)(function)
@@ -66,7 +62,7 @@ def created(
6662
id: str,
6763
name: str = None,
6864
repoid: str = None,
69-
data :List[str] = None,
65+
data: List[str] = None,
7066
):
7167
print_function_args()
7268
attributes = {
@@ -92,7 +88,7 @@ def deleted(
9288
id: str,
9389
name: str = None,
9490
repoid: str = None,
95-
data :List[str] = None,
91+
data: List[str] = None,
9692
):
9793
print_function_args()
9894
attributes = {
@@ -109,4 +105,3 @@ def deleted(
109105

110106
# send and print event
111107
requests.post(cde_sink, headers=headers, data=body)
112-

cli/cdevents/cli/build.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
"""Module for cli build commands."""
22
from __future__ import annotations
3-
import os
43

4+
import os
55
from typing import List
66

77
import click
88
import requests
9-
109
from cloudevents.http import CloudEvent, to_structured
1110

12-
from cdevents.cli.utils import (
13-
add_disclaimer_text,
14-
print_function_args,
15-
)
11+
from cdevents.cli.utils import add_disclaimer_text, print_function_args
1612

1713

1814
# pylint: disable=unused-argument
@@ -51,8 +47,8 @@ def common_build_options(function):
5147
"--data",
5248
"-d",
5349
required=False,
54-
#type=click.Tuple([str, str]),
55-
type=(str,str),
50+
# type=click.Tuple([str, str]),
51+
type=(str, str),
5652
multiple=True,
5753
help="Build Data.",
5854
)(function)
@@ -67,7 +63,7 @@ def started(
6763
id: str,
6864
name: str = None,
6965
artifact: str = None,
70-
data :List[str] = None,
66+
data: List[str] = None,
7167
):
7268
print_function_args()
7369
attributes = {
@@ -93,7 +89,7 @@ def finished(
9389
id: str,
9490
name: str = None,
9591
artifact: str = None,
96-
data :List[str] = None,
92+
data: List[str] = None,
9793
):
9894
print_function_args()
9995
attributes = {
@@ -111,14 +107,15 @@ def finished(
111107
# send and print event
112108
requests.post(cde_sink, headers=headers, data=body)
113109

110+
114111
@click.command(help=add_disclaimer_text("PipelineRun Queued CloudEvent."))
115112
@common_build_options
116113
def queued(
117114
cde_sink: str,
118115
id: str,
119116
name: str = None,
120117
artifact: str = None,
121-
data :List[str] = None,
118+
data: List[str] = None,
122119
):
123120
print_function_args()
124121
attributes = {

cli/cdevents/cli/env.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
"""Module for cli environment commands."""
22
from __future__ import annotations
3-
import os
43

4+
import os
55
from typing import List
66

77
import click
88
import requests
9-
109
from cloudevents.http import CloudEvent, to_structured
1110

12-
from cdevents.cli.utils import (
13-
add_disclaimer_text,
14-
print_function_args,
15-
)
11+
from cdevents.cli.utils import add_disclaimer_text, print_function_args
1612

1713

1814
# pylint: disable=unused-argument
@@ -51,7 +47,7 @@ def common_env_options(function):
5147
"--data",
5248
"-d",
5349
required=False,
54-
type=(str,str),
50+
type=(str, str),
5551
multiple=True,
5652
help="Environment's Data.",
5753
)(function)
@@ -66,7 +62,7 @@ def created(
6662
id: str,
6763
name: str = None,
6864
repo: str = None,
69-
data :List[str] = None,
65+
data: List[str] = None,
7066
):
7167
print_function_args()
7268
attributes = {
@@ -84,14 +80,15 @@ def created(
8480
# send and print event
8581
requests.post(cde_sink, headers=headers, data=body)
8682

83+
8784
@click.command(help=add_disclaimer_text("Environment Deleted CloudEvent."))
8885
@common_env_options
8986
def deleted(
9087
cde_sink: str,
9188
id: str,
9289
name: str = None,
9390
repo: str = None,
94-
data :List[str] = None,
91+
data: List[str] = None,
9592
):
9693
print_function_args()
9794
attributes = {
@@ -117,7 +114,7 @@ def modified(
117114
id: str,
118115
name: str = None,
119116
repo: str = None,
120-
data :List[str] = None,
117+
data: List[str] = None,
121118
):
122119
print_function_args()
123120
attributes = {
@@ -134,4 +131,3 @@ def modified(
134131

135132
# send and print event
136133
requests.post(cde_sink, headers=headers, data=body)
137-

0 commit comments

Comments
 (0)