Skip to content

Commit

Permalink
Merge pull request #34 from ipmdijkstra/patch-2
Browse files Browse the repository at this point in the history
seamless deploy (zero downtime) feature added to xldeploy apigee plugin
  • Loading branch information
brhahlen authored Jul 15, 2019
2 parents 94ed7d6 + bf450ef commit e58667d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Binary file modified images/apigee-Organization.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/main/resources/apigee/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def __init__(self, organization, target_environment=None):
self.target_environment = target_environment.environmentName
self.authentication = (organization.username, organization.password)
self.mfa = organization.mfa
self.seamless = organization.seamless
self.token = None
self.sso_login_url = "https://login.apigee.com/oauth/token"
self.proxy_dict = None
Expand Down Expand Up @@ -80,6 +81,8 @@ def get_revision_numbers_of_apiproxy_deployed_to_environment(self, apiProxyName)
url = self.build_org_url()
url = url + "/environments/" + self.target_environment
url = url + "/apis/" + apiProxyName + '/deployments'
if self.seamless:
url = url + '?override=true&delay' + self.organization.delay
print("The URL that is being used to get the revision numbers deployed to environment:")
print(url)
authorization_headers = self.build_authorization_header()
Expand All @@ -99,6 +102,8 @@ def get_revision_numbers_of_apiproxy_deployed_to_environment(self, apiProxyName)
url = self.build_org_url()
url = url + "/environments/" + self.target_environment
url = url + "/apis/" + apiProxyName + '/deployments'
if self.seamless:
url = url + '?override=true&delay' + self.organization.delay
authorization_headers = self.build_authorization_header()
print("Get revision numbers: \n")
print(url)
Expand Down Expand Up @@ -192,6 +197,8 @@ def deploy_api_proxy(self, api_proxy, api_proxy_revision):
revision = parse_revision(api_proxy_revision)
url = self.build_api_proxy_url(api_proxy, revision)
url = url + "/deployments"
if self.seamless:
url = url + '?override=true&delay' + self.organization.delay
print("The URL that is being used to deploy the API Proxy %s/%s to environment %s" % (api_proxy, api_proxy_revision, self.target_environment))
print(url)
return self.deploy(url, api_proxy, api_proxy_revision)
Expand All @@ -200,6 +207,8 @@ def deploy_shared_flow(self, shared_flow, shared_flow_revision):
revision = parse_revision(shared_flow_revision)
url = self.build_shared_flow_url(shared_flow, revision)
url = url + "/deployments"
if self.seamless:
url = url + '?override=true&delay' + self.organization.delay
print("The URL that is being used to deploy the shared flow %s/%s to environment %s" % (shared_flow, shared_flow_revision, self.target_environment))
print(url)
return self.deploy(url, shared_flow, shared_flow_revision)
Expand All @@ -224,6 +233,8 @@ def undeploy_api_proxy(self, api_proxy, api_proxy_revision):
revision = parse_revision(api_proxy_revision)
url = self.build_api_proxy_url(api_proxy, revision)
url = url + "/deployments"
if self.seamless:
url = url + '?override=true&delay' + self.organization.delay
print("The URL that is being used to undeploy the API Proxy %s/%s from environment %s" % (api_proxy, api_proxy_revision, self.target_environment))
print(url)
return self.undeploy(url, api_proxy, api_proxy_revision)
Expand All @@ -232,6 +243,8 @@ def undeploy_shared_flow(self, shared_flow, shared_flow_revision):
revision = parse_revision(shared_flow_revision)
url = self.build_shared_flow_url(shared_flow, revision)
url = url + "/deployments"
if self.seamless:
url = url + '?override=true&delay' + self.organization.delay
print("The URL that is being used to undeploy the shared flow %s/%s from environment %s" % (shared_flow, shared_flow_revision, self.target_environment))
print(url)
return self.undeploy(url, shared_flow, shared_flow_revision)
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/synthetic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<property name="password" password="true" description="The password to connect to this Apigee organization" />
<property name="mfa" kind="boolean" default="False" description="Multi factor authentication is on" />
<property name="secretKey" password="true" required="false" description="The OTP secret key for Apigee. Required when MFA is on" />
<property name="seamless" kind="boolean" default="False" description="Use seamless deploy of versions" />
<property name="delay" default="15" required="false" description="Seconds to wait before the old version is undeployed. Required when seamless is on" />
<method name="CheckConnection" delegate="jythonScript" description="Check connection for Apigee organization" script="apigee/check-organization-connection.py" />
</type>

Expand Down

0 comments on commit e58667d

Please sign in to comment.