Fixed false positve warning on no files changed

parent 464c9b37
Pipeline #2042 passed with stages
in 1 minute and 29 seconds
......@@ -12,19 +12,22 @@ aws_client = AWS_Client()
@click.option("--server", required=True, help="URL that Kubernetes control plane can be reached (with protocol)")
@click.option("--token", required=True, help="Authentication token")
@click.option("--ca-file-path", required=True, help="Path to a file with the server's CA")
@click.option("--skip-auth", is_flag=True, help="Temporary flag for skipping auth while we don't need it for other commands")
@click.pass_context
def k8s(ctx, applications, server, token, ca_file_path):
from kubernetes import client, config
def k8s(ctx, applications, server, token, ca_file_path, skip_auth):
if skip_auth:
ctx.obj = {'applications': applications}
else:
from kubernetes import client, config
configuration = client.Configuration()
configuration.host = server
configuration.ssl_ca_cert = ca_file_path
configuration.debug = True
configuration.api_key={"authorization":"Bearer {}".format(token)}
configuration = client.Configuration()
configuration.host = server
configuration.ssl_ca_cert = ca_file_path
configuration.debug = True
configuration.api_key={"authorization":"Bearer {}".format(token)}
ctx.obj = {'configuration': configuration, 'applications': applications}
ctx.obj = {'configuration': configuration, 'applications': applications}
pass
@k8s.command()
@click.pass_context
......@@ -34,7 +37,7 @@ def monitor_deployment(ctx):
from .monitor_deployment import monitor_deployment
k8s_monitor = monitor_deployment.MonitorDeployment(configuration, applications)
k8s_monitor.deploy_update()
k8s_monitor.monitor_update()
@k8s.command()
......@@ -45,7 +48,6 @@ def monitor_deployment(ctx):
@click.pass_context
def update_deployment(ctx, new_image, new_tag, file_paths, dry_run):
applications = ctx.obj.get('applications')
configuration = ctx.obj.get('configuration')
from .update_deployment import update_deployment
......
......@@ -8,10 +8,12 @@ class MonitorDeployment():
client.Configuration.set_default(configuration)
self.api = client.CoreV1Api()
self.core_api = client.CoreV1Api()
self.apps_api = client.AppsV1Api()
# TODO:
# kubectl --certificate-authority ca.crt --server $K8S_URL --token $K8S_TOKEN apply -f full_spec.yml
def deploy_update(self):
self.api.list_pod_for_all_namespaces(watch=False)
def monitor_update(self):
result = self.apps_api.read_namespaced_deployment(namespace="dispute", name="dispute")
print(result)
......@@ -65,8 +65,8 @@ class UpdateDeployment():
tag = container['image'].split(":")[-1]
container['image'] = "{image}:{tag}".format(image = image, tag = tag)
logging.warning("Didn't find any containers from the array {}, and didn't change any files".format(self.applications))
else:
logging.warning("Didn't find any containers from the array {}, and didn't change any files".format(self.applications))
return specs
......
......@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
setuptools.setup(
name="akinaka",
python_requires='>=3.3.0',
version="0.2.23",
version="0.2.24",
author="Afraz",
author_email="afraz@olindata.com",
description="OlinData's aws cli Extras",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment