Skip to content

Commit

Permalink
Merge remote-tracking branch 'internal/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
jvallexm committed Mar 29, 2024
2 parents 4fed328 + 9898df4 commit 3e235b2
Show file tree
Hide file tree
Showing 102 changed files with 6,441 additions and 6,469 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,4 @@ tfxjs.tfvars
/build
.icse/
tf-test/
dev/

vars.yml
dev/
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@

All notable changes to this project will be documented in this file.

## 1.14.0

### Upgrade Notes


### Features

- Users can now update existing CRAIG templates and download the updated tar file by using the endpoint POST `/api/craig/template-tar/:template`
- From the options page, users can now enable Manual Power VSI naming. When this is enabled, the environment prefix will not be prepended to the names of Power VS Virtual Server or FalconStor VTL instances
- Users can now provision VPC VSI deployments using an existing volume snapshot by using the `Create VSI From Snapshot` toggle. A list of snapshots will be dynamically retrieved using the IBM Cloud API based on the region selected in your project
- When creating a VSI Deployment, users can select a new toggle `Include Name Variables`. When this value is set to true, VSI names will be populated as variables in Terrafrom. This allows for users to have full control over VSI names without needing to directly modify Terraform scripts
- Power VS Virtual Server and FalconStor VTL system types are now retrieved dynamically using the Power VS API based on the zone
- Power Edge Router is now supported for `syd05`
- CRAIG now supports the Power VS region `osa21`
- When updating a VPC's Public Gateways, invalid gateways will automatically be removed from subnets where they are enabled

### Fixes

- Fixed an issue causing Power VS API endpoints for Sao Palo availability zones to fail
- Fixed an issue causing VPC subnets to incorrectly have `public_gateway` set to true when no public gateway is created in the corresponding zone
- Fixed an issue causing the Resource Group field for Key Management services to not be rendered when using a resource from data

## 1.13.1

### Upgrade Notes
Expand All @@ -11,6 +33,8 @@ All notable changes to this project will be documented in this file.
- `.env.example` has been updated to include a warning that included quotation marks in .env values will cause the application to crash
- When fetching VSI Images, the Craig API has no limit on the number of images that can be retrieved. In addition, only available images are retrieved
- Power VS Network interface outputs now use the Terraform field `pi_network_name` instead of the depricated field `name`
- When updating a project's region, VSI images are now reset to ensure that images are available in the selected region
- When updating a Power VS workspace availability zone, storage tiers and storage pools are now reset for Power VS Instances, Volumes, and FalconStor VTLs

### Features

Expand Down
23 changes: 7 additions & 16 deletions ansible/template-test/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@
- role: create_schematics_workspace
vars:
description: Automated CRAIG Testing Workspace
tags: ["craig"]

- name: TODO - convert to roles
hosts: localhost
vars_files: ./vars/vars.yml
tasks:
- name: Upload {{template}}.tar to Schematics Workspace
command: "curl -s --request PUT \
ansible.builtin.shell: "curl -s --request PUT \
--url 'https://schematics.cloud.ibm.com/v1/workspaces/{{ workspace.json.id }}/template_data/{{ workspace.json.template_data[0].id }}/template_repo_upload' \
-H 'Authorization: Bearer {{ token.json.access_token }}' \
-H 'Content-Type: multipart/form-data' \
--form 'file=@{{playbook_dir}}/{{template}}.tar'"
async: 120
- name: Wait until {{template}}.tar has been successfully uploaded
uri:
url: https://schematics.cloud.ibm.com/v1/workspaces/{{ workspace.json.id }}
Expand All @@ -45,13 +43,6 @@
vars_files: ./vars/vars.yml
roles:
- role: update_variablestore
vars:
# Additional variables can be added to the variablestore by adding elements to the array below.
# Each element must be a map of the following key/value pairs:
# {'name': string, 'secure': bool, 'use_default': bool, 'value': variable_value}
# Note: If using a variable defined in /vars/vars.yml, specify the map using the following syntax:
# {'name': string, 'secure': bool, 'use_default': bool, 'value': "{{variable}}"}
additional_variables: [{'name': ssh_key_public_key, 'secure': true, 'use_default': false, 'value': "{{ssh_key}}"}]
- role: update_workspace_variables
- name: Start generate plan action
hosts: localhost
Expand All @@ -60,29 +51,29 @@
- role: get_iam_token
- role: action
vars:
action: plan
action_type: plan
- role: get_iam_token
- role: await_action
vars:
action: plan
action_type: plan
register_name: await_plan
- role: get_iam_token
- role: action
vars:
action: apply
action_type: apply
- role: get_iam_token
- role: await_action
vars:
action: apply
action_type: apply
register_name: await_apply
- role: get_iam_token
- role: action
vars:
action: destroy
action_type: destroy
- role: get_iam_token
- role: await_action
vars:
action: destroy
action_type: destroy
register_name: await_destroy
- role: get_iam_token
- role: delete_schematics_workspace
6 changes: 3 additions & 3 deletions ansible/template-test/roles/action/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
# tasks file for action
- name: Start {{ action }} action
- name: Start {{ action_type }} action
uri:
url: https://schematics.cloud.ibm.com/v1/workspaces/{{ workspace.json.id }}/{{ action }}
method: "{{ 'POST' if action == 'plan' else 'PUT' }}"
url: https://schematics.cloud.ibm.com/v1/workspaces/{{ workspace.json.id }}/{{ action_type }}
method: "{{ 'POST' if action_type == 'plan' else 'PUT' }}"
body_format: json
headers:
Authorization: Bearer {{token.json.access_token}}
Expand Down
2 changes: 1 addition & 1 deletion ansible/template-test/roles/await_action/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- name: Ensure {{ action }} finishes
- name: Ensure {{ action_type }} finishes
uri:
url: https://schematics.cloud.ibm.com/v2/jobs/{{ action_result.json.activityid }}
method: GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"resource_group": "{{ resource_group }}"
"type": ["terraform_v1.5"]
"location": "{{ region }}"
"description": "{{ description }}"
"tags": "{{ tags }}"
"description": "Automated CRAIG Testing Workspace"
"tags": ["craig"]
"template_data": [{ "type": "terraform_v1.5"}]
status_code: 201
register: workspace
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
Authorization: Bearer {{token.json.access_token}}
status_code: 200
register: delete_response
until: delete_response.status == 200
until: delete_response.status == 200 or delete_response.status == 404
retries: 2
delay: 120
2 changes: 1 addition & 1 deletion ansible/template-test/roles/download_tar/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
get_url:
url: "{{craig_url}}/{{template}}"
dest: "{{playbook_dir}}/{{template}}.tar"
async: 120
timeout: 300
retries: 10
2 changes: 1 addition & 1 deletion ansible/template-test/roles/get_iam_token/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
method: POST
headers:
Content-Type: application/x-www-form-urlencoded
body: "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey={{api_key}}"
body: "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey={{tf_var_api_key}}"
register: token
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# tasks file for update_variablestore
- name: Add variable to variable store
- name: Update variablestore
set_fact:
variablestore: "{{ variablestore + additional_variables }}"
variablestore: "{{ variablestore + [{'name': item, 'secure': true, 'use_default': false, 'value': tf_var_ssh_key}] }}"
loop: "{{template_map[template]}}"
38 changes: 38 additions & 0 deletions ansible/template-test/vars/vars.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# To run this in schematics actions, you will need to update the below commented out variables inside of schematics
# DO NOT ENTER YOUR VARIBLES HERE. THIS FILE SHOULD NEVER BE EDITED
# Do not alter the other variables.

# tf_var_api_key: <api-key>
# tf_var_ssh_key: <ssh-key>
# tf_var_prefix: <unique-prefix>
# template: <template> must be spelled exactly as in template_map below
# workspace_name: <workspace-name>

craig_url: https://craig.119gqgw56ti1.us-south.codeengine.appdomain.cloud/api/craig/template-tar
region: us-south
resource_group: craig-rg
variablestore: [
{
"name": "ibmcloud_api_key",
"secure": true,
"use_default": false,
"value": "{{tf_var_api_key}}"
},
{
"name": "prefix",
"use_default": false,
"value": "{{tf_var_prefix}}"
}
]
template_map:
from-scratch: []
mixed: ["ssh_key_public_key"]
vsi: ["slz_ssh_key_public_key"]
vsi-edge: ["slz_ssh_key_public_key"]
power-vs-sap-hana: ["ssh_key_public_key", "power_secure_powervs_power_ssh_key_key"]
oracle-rac: ["power_oracle_template_power_ssh_key"]
oracle-si: ["power_oracle_template_power_ssh_key"]
power-vs-poc: ["vsi_ssh_key_public_key", "dal10gw_on_prem_connection_preshared_key", "power_dal10_powervs_ssh_key_key"]
quick-start-power: ["vsi_ssh_key_public_key"]
vpnaas: []
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "craig",
"version": "1.13.0",
"version": "1.14.0",
"private": true,
"license": "Apache-2.0",
"scripts": {
Expand Down
18 changes: 4 additions & 14 deletions client/src/components/forms/duplicate-rules/CopyRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,11 @@ import { isNullOrEmptyString, splat, contains } from "lazy-z";
import { Replicate } from "@carbon/icons-react";
import PropTypes from "prop-types";
import { CraigFormHeading, CraigFormGroup, PrimaryButton } from "../utils";
import { copyRuleFormName } from "../../../lib";

const CopyRule = (props) => {
let ruleType = props.isSecurityGroup ? "Security Group" : "ACL";

/**
* get form name for icse props
* @param {string} field name of field
* @returns {string} form name string
*/
function getFormName(field) {
return `copy-rule-${props.isSecurityGroup ? "sg" : "acl"}-${field}${
props.isSecurityGroup ? "" : "-" + props.data.name
}`;
}

return (
<>
<CraigFormHeading
Expand All @@ -31,7 +21,7 @@ const CopyRule = (props) => {
<CraigFormGroup noMarginBottom className="align-row">
<DynamicFormSelect
name="ruleSource"
propsName={getFormName("source")}
propsName={copyRuleFormName(props)("source")}
keyIndex={0}
value={props.ruleSource}
field={{
Expand All @@ -56,7 +46,7 @@ const CopyRule = (props) => {
/>
<DynamicFormSelect
name="ruleCopyName"
propsName={getFormName("rule")}
propsName={copyRuleFormName(props)("rule")}
keyIndex={0}
value={props.ruleCopyName}
field={{
Expand Down Expand Up @@ -93,7 +83,7 @@ const CopyRule = (props) => {
/>
<DynamicFormSelect
name="ruleDestination"
propsName={getFormName("destination")}
propsName={copyRuleFormName(props)("destination")}
keyIndex={0}
value={props.ruleDestination}
field={{
Expand Down
15 changes: 3 additions & 12 deletions client/src/components/forms/duplicate-rules/CopyRuleObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,9 @@ import { Replicate } from "@carbon/icons-react";
import PropTypes from "prop-types";
import { CraigFormGroup, CraigFormHeading, PrimaryButton } from "../utils";
import { DynamicFormSelect } from "../dynamic-form";
import { copyRuleFormName } from "../../../lib";

const CopyRuleObject = (props) => {
/**
* get form name for icse props
* @param {string} field name of field
* @returns {string} form name string
*/
function getFormName(field) {
return `copy-rule-${props.isSecurityGroup ? "sg" : "acl"}-${field}${
props.isSecurityGroup ? "" : "-" + props.data.name
}`;
}
return (
<>
<CraigFormHeading
Expand All @@ -34,7 +25,7 @@ const CopyRuleObject = (props) => {
<CraigFormGroup className="align-row">
<DynamicFormSelect
name="source"
propsName={getFormName("source")}
propsName={copyRuleFormName(props)("source")}
keyIndex={0}
value={props.source}
field={{
Expand Down Expand Up @@ -78,7 +69,7 @@ const CopyRuleObject = (props) => {
/>
<DynamicFormSelect
name="destinationVpc"
propsName={getFormName("destination")}
propsName={copyRuleFormName(props)("destination")}
keyIndex={0}
value={props.destinationVpc}
field={{
Expand Down

0 comments on commit 3e235b2

Please sign in to comment.