Skip to content

Commit

Permalink
Update workflow to release solutions too
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Sundberg <[email protected]>
  • Loading branch information
seansund committed Mar 24, 2023
1 parent 7a95a59 commit de61538
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 114 deletions.
8 changes: 7 additions & 1 deletion .github/scripts/bom-changes-to-details.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ bom_details() {
display_name=$(yq e '.metadata.annotation.displayName // ""' "${bom}")
description=$(yq e '.metadata.annotation.description // ""' "${bom}")
category=$(yq e '.metadata.labels.type // ""' "${bom}")
if [[ "${bom}" =~ ^solutions ]]; then
type="solution"
else
type="bom"
fi

release_name="${name}_${version}"

if [[ -z "${display_name}" ]]; then
Expand All @@ -30,7 +36,7 @@ bom_details() {
description="Layer for ${name}"
fi

RESULT=$(echo "${RESULT}" | jq --arg name "${name}" --arg file "${bom}" --arg version "${version}" --arg release "${release_name}" --arg displayName "${display_name}" --arg description "${description}" --arg category "${category}" '. += [{"name": $name, "version": $version, "release_name": $release, "display_name": $displayName, "description": $description, "category": $category, "file": $file}]')
RESULT=$(echo "${RESULT}" | jq --arg name "${name}" --arg file "${bom}" --arg version "${version}" --arg release "${release_name}" --arg displayName "${display_name}" --arg description "${description}" --arg category "${category}" --arg type "${type}" '. += [{"name": $name, "version": $version, "release_name": $release, "display_name": $displayName, "description": $description, "category": $category, "file": $file, "type": $type}]')
}

if [[ -n "${CHANGED_BOMS}" ]]; then
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/releases-to-index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ while read -r release; do
display_name=$(echo "${release}" | jq -r '.display_name')
description=$(echo "${release}" | jq -r '.description')
category=$(echo "${release}" | jq -r '.category')
type=$(echo "${release}" | jq -r '.type')

release_url="${BASE_URL}/${release_name}/bom.yaml"

Expand All @@ -45,7 +46,7 @@ while read -r release; do

INDEX_JSON=$(echo "${INDEX_JSON}" | jq --arg name "${name}" --argjson bom "${release_json}" '(.boms[] | select(.name == $name)) |= $bom')
else
release_json=$(jq -n -c --arg name "${name}" --arg displayName "${display_name}" --arg description "${description}" --arg category "${category}" --argjson version "${version_json}" '{"name": $name, "displayName": $displayName, "description": $description, "type": "bom", "versions": [$version]}')
release_json=$(jq -n -c --arg name "${name}" --arg displayName "${display_name}" --arg description "${description}" --arg category "${category}" --arg type "$type" --argjson version "${version_json}" '{"name": $name, "displayName": $displayName, "description": $description, "type": $type, "versions": [$version]}')

INDEX_JSON=$(echo "${INDEX_JSON}" | jq --arg name "${name}" --argjson bom "${release_json}" '.boms += [$bom]')
fi
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ jobs:
path: gh-pages
ref: refs/heads/gh-pages

- name: Get changed files in the boms/ folder
- name: Get changed files in the boms/ and solutions/ folders
id: changed-files
uses: tj-actions/changed-files@v35
with:
path: main
files: boms/**
files: |
boms/**
solutions/**
- name: Run step if any file(s) in the boms folder change
- name: Run step if any file(s) in the boms/ or solutions/ folder change
if: steps.changed-files.outputs.any_changed == 'true'
run: |
echo "One or more files in the boms folder has changed."
Expand Down
101 changes: 0 additions & 101 deletions boms/software/4xx-maximo/400-mas-core-multicloud.yaml

This file was deleted.

50 changes: 50 additions & 0 deletions boms/software/4xx-maximo/400-mas-core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: cloud.ibm.com/v1alpha1
kind: BillOfMaterial
metadata:
name: 400-mas-core
labels:
type: software
code: '400'
annotations:
displayName: Maximo Application Suite Core
description: GitOps deployment of Maximo Application Suite Core for OpenShift
deployment-type/gitops: "true"
spec:
version: v2.0.0
modules:
- name: ocp-login

- name: gitops-namespace
alias: gitea_namespace
variables:
- name: name
value: gitea

- name: gitea
dependencies:
- id: namespace
ref: gitea_namespace

- name: gitops-repo

# Storage Class Manager
- name: util-storage-class-manager
variables:
- name: rwx_storage_class
scope: global
- name: rwo_storage_class
scope: global
- name: file_storage_class
scope: global
- name: block_storage_class
scope: global

# Maximo Core
- name: gitops-mas-core
variables:
- name: license_key
important: true
- name: license_key_file
important: true

- name: util-mas-core-ready
11 changes: 3 additions & 8 deletions boms/software/4xx-maximo/405-mas-manage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ metadata:
description: GitOps deployment of Maximo Manage application for OpenShift
deployment-type/gitops: "true"
spec:
version: v1.0.0
version: v2.0.0
modules:
- name: gitops-repo

# Maximo Application Suite - Manage
- name: util-mas-core-existing
# Maximo Application Suite - Manage
- name: gitops-mas-manage
variables:
- name: instanceid
value: masdemo
- name: workspace_id
value: demo

0 comments on commit de61538

Please sign in to comment.