Browse Source

add environment management + minor fixes

pull/25/head
Nicolas Massé 8 years ago
parent
commit
9d389f040b
  1. 3
      defaults/main.yml
  2. 24
      tasks/read_openapi_file.yml

3
defaults/main.yml

@ -6,6 +6,9 @@ threescale_cicd_default_application_name: 'Ansible smoke-tests default applicati
threescale_cicd_default_application_description: 'This app is used to run smoke tests during the deployment phase. It will be automatically recreated if you delete it.'
threescale_cicd_staging_environment_name: sandbox
threescale_cicd_production_environment_name: production
threescale_cicd_default_staging_suffix: -staging
threescale_cicd_default_production_suffix: ""
threescale_cicd_default_apicast_scheme: https
threescale_cicd_default_oauth_scopes:
openid: Any OpenID Connect token
threescale_cicd_application_plans:

24
tasks/read_openapi_file.yml

@ -66,23 +66,43 @@
set_fact:
threescale_cicd_api_system_name_suffix: '{{ (threescale_cicd_api_system_name is not defined)|ternary("_" ~ (threescale_cicd_api_version_major|regex_replace(''[^a-zA-Z0-9_]+'', ''_'')), "") }}'
- name: Compute the system_name prefix to prepend to the generated system_name
set_fact:
threescale_cicd_api_system_name_prefix: '{{ (threescale_cicd_api_system_name is not defined and threescale_cicd_env is defined)|ternary((threescale_cicd_env|regex_replace(''[^a-zA-Z0-9_]+'', ''_'')) ~ "_", "") }}'
- name: Extract the wanted system_name from OpenAPI
set_fact:
threescale_cicd_api_system_name: '{{ threescale_cicd_openapi_file_content.info[''x-threescale-system-name'']|regex_replace(''[^a-zA-Z0-9_]+'', ''_'') }}'
threescale_cicd_api_system_name: '{{ threescale_cicd_openapi_file_content.info[''x-threescale-system-name'']|regex_replace(''[^a-zA-Z0-9_]+'', ''_'')|lower }}'
when: 'threescale_cicd_api_system_name is not defined and ''x-threescale-system-name'' in threescale_cicd_openapi_file_content.info'
- name: Generate a system_name from the API title
set_fact:
threescale_cicd_api_system_name: '{{ threescale_cicd_openapi_file_content.info[''title'']|default(''api'')|regex_replace(''[^a-zA-Z0-9_]+'', ''_'') }}'
threescale_cicd_api_system_name: '{{ threescale_cicd_openapi_file_content.info[''title'']|default(''api'')|regex_replace(''[^a-zA-Z0-9_]+'', ''_'')|lower }}'
when: 'threescale_cicd_api_system_name is not defined'
- name: Append the major version to the system_name
set_fact:
threescale_cicd_api_system_name: '{{ threescale_cicd_api_system_name }}{{ threescale_cicd_api_system_name_suffix }}'
- name: Set the threescale_cicd_apicast_{sandbox,production}_endpoint variable from the wildcard domain
set_fact:
threescale_cicd_apicast_sandbox_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ threescale_cicd_api_system_name|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_staging_suffix }}.{{ threescale_cicd_wildcard_domain }}'
threescale_cicd_apicast_production_endpoint: '{{ threescale_cicd_default_apicast_scheme }}://{{ threescale_cicd_api_system_name|regex_replace(''[^a-zA-Z0-9-]+'', ''-'')|lower }}{{ threescale_cicd_default_production_suffix }}.{{ threescale_cicd_wildcard_domain }}'
when: 'threescale_cicd_wildcard_domain is defined'
- name: Prefix the system_name with the environment
set_fact:
threescale_cicd_api_system_name: '{{ threescale_cicd_api_system_name_prefix }}{{ threescale_cicd_api_system_name }}'
- name: Append the full version to the API title
set_fact:
threescale_cicd_api_name: '{{ threescale_cicd_api_name }} (v{{ threescale_cicd_api_version }})'
when: 'threescale_cicd_env is not defined'
- name: Append the full version and the environment to the API title
set_fact:
threescale_cicd_api_name: '{{ threescale_cicd_api_name }} ({{ threescale_cicd_env|upper }}, v{{ threescale_cicd_api_version }})'
when: 'threescale_cicd_env is defined'
- name: Extract the security definitions and requirements from OpenAPI
set_fact:

Loading…
Cancel
Save