From d5face0459ceb6da111ae000b2be8880f5d7feee Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:18:40 +0200 Subject: [PATCH 01/12] add summary --- oblt-cli/cluster-create-ccs/action.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 9fee4cff..86949959 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -108,6 +108,13 @@ runs: ${{ steps.flags.outputs.ELASTICSEARCH_DOCKER_IMAGE }} \ ${{ steps.flags.outputs.DRY_RUN }} \ ${{ steps.flags.outputs.GITOPS }} + --output-file="${GITHUB_WORKSPACE}/cluster-info.json" shell: bash env: GITHUB_TOKEN: ${{ inputs.github-token }} + - name: summary + run: | + cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") + echo "### oblt-cli :rocket: + echo "https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${CLUSTER_NAME}" >> $GITHUB_STEP_SUMMARY + shell: bash From 1d143f2e9229fafd0ac6c40655387f87a38c6a87 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:19:48 +0200 Subject: [PATCH 02/12] fix --- oblt-cli/cluster-create-ccs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 86949959..2aa7d3da 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -107,7 +107,7 @@ runs: ${{ steps.flags.outputs.CLUSTER_NAME_SUFFIX }} \ ${{ steps.flags.outputs.ELASTICSEARCH_DOCKER_IMAGE }} \ ${{ steps.flags.outputs.DRY_RUN }} \ - ${{ steps.flags.outputs.GITOPS }} + ${{ steps.flags.outputs.GITOPS }} \ --output-file="${GITHUB_WORKSPACE}/cluster-info.json" shell: bash env: From ff29ea695c432195020718eeff78e7dfa2673f0c Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:21:05 +0200 Subject: [PATCH 03/12] ok --- oblt-cli/cluster-create-ccs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 2aa7d3da..68288edb 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -116,5 +116,5 @@ runs: run: | cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") echo "### oblt-cli :rocket: - echo "https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${CLUSTER_NAME}" >> $GITHUB_STEP_SUMMARY + echo "https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name}" >> $GITHUB_STEP_SUMMARY shell: bash From 0f147d98ae1e7162618008683b182e0784f8758b Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:22:05 +0200 Subject: [PATCH 04/12] test --- oblt-cli/cluster-create-ccs/action.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 68288edb..6d1158a4 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -115,6 +115,8 @@ runs: - name: summary run: | cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") - echo "### oblt-cli :rocket: - echo "https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name}" >> $GITHUB_STEP_SUMMARY + { + echo "### oblt-cli :rocket:" + echo "https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name}" + } >> $GITHUB_STEP_SUMMARY shell: bash From a869bdd03721004d39d1a182b7f10a33aec50ea5 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:26:23 +0200 Subject: [PATCH 05/12] test --- oblt-cli/cluster-create-ccs/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 6d1158a4..9b54e852 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -116,7 +116,8 @@ runs: run: | cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") { - echo "### oblt-cli :rocket:" - echo "https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name}" + echo "### oblt-cli" + echo "Cluster created: ${cluster_name} (Status)" + echo "Status: https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name}" } >> $GITHUB_STEP_SUMMARY shell: bash From e04c2d32f9aae825bc2c3f635780d346fc328da2 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:28:02 +0200 Subject: [PATCH 06/12] test --- oblt-cli/cluster-create-ccs/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 9b54e852..a69e2f3f 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -117,7 +117,6 @@ runs: cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") { echo "### oblt-cli" - echo "Cluster created: ${cluster_name} (Status)" - echo "Status: https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name}" + echo "Cluster name: [${cluster_name}](https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name})" } >> $GITHUB_STEP_SUMMARY shell: bash From 495bc4268218216081ff7da8e97d1f82d781b19c Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:30:53 +0200 Subject: [PATCH 07/12] test --- oblt-cli/cluster-create-ccs/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index a69e2f3f..46ac8f6f 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -117,6 +117,8 @@ runs: cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") { echo "### oblt-cli" - echo "Cluster name: [${cluster_name}](https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name})" + echo "| Cluster Name | Status |" + echo "|--------------|--------|" + echo "| `${cluster_name}` | https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name} |" } >> $GITHUB_STEP_SUMMARY shell: bash From e8c3e5c8e308bda675b55c55116f08630bf5590e Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 26 Jun 2024 22:32:13 +0200 Subject: [PATCH 08/12] test --- oblt-cli/cluster-create-ccs/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 46ac8f6f..02097217 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -116,9 +116,9 @@ runs: run: | cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") { - echo "### oblt-cli" + echo "### oblt-cli cluster info" echo "| Cluster Name | Status |" echo "|--------------|--------|" - echo "| `${cluster_name}` | https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name} |" + echo "| ${cluster_name} | https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name} |" } >> $GITHUB_STEP_SUMMARY shell: bash From 849052219b815d3ae796ff7fe7679d304afd531a Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 27 Jun 2024 01:13:55 +0200 Subject: [PATCH 09/12] test --- oblt-cli/cluster-create-ccs/action.yml | 14 +++++--------- oblt-cli/cluster-create-ccs/summary.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 oblt-cli/cluster-create-ccs/summary.js diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 02097217..7651fc29 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -113,12 +113,8 @@ runs: env: GITHUB_TOKEN: ${{ inputs.github-token }} - name: summary - run: | - cluster_name=$(jq -r '.ClusterName' "${GITHUB_WORKSPACE}/cluster-info.json") - { - echo "### oblt-cli cluster info" - echo "| Cluster Name | Status |" - echo "|--------------|--------|" - echo "| ${cluster_name} | https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${cluster_name} |" - } >> $GITHUB_STEP_SUMMARY - shell: bash + uses: actions/github-script@v7 + with: + script: | + const summary = require('${{ github.workspace }}/summary.js') + await summary({github, context, core}) diff --git a/oblt-cli/cluster-create-ccs/summary.js b/oblt-cli/cluster-create-ccs/summary.js new file mode 100644 index 00000000..c57e5bea --- /dev/null +++ b/oblt-cli/cluster-create-ccs/summary.js @@ -0,0 +1,14 @@ +const fs = require('fs') + +module.exports = async ({github, context, core}) => { + const clusterInfo = JSON.parse(fs.readFileSync(`${process.env.GITHUB_WORKSPACE}/cluster-info.json`, 'utf8')) + const statusUrl = `https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${clusterInfo.ClusterName}` + await core.summary + .addHeading('Test Results') + .addTable([ + [{data: 'Cluster Name', header: true}, {data: 'Stack Version', header: true}, {data: 'Status', header: true}], + [clusterInfo.ClusterName, clusterInfo.StackVersion, clusterInfo.RemoteClusterName], + ]) + .addLink('View staging deployment!', statusUrl) + .write() +} From de842b766c41e781c03036d2066780964a3d54a7 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 27 Jun 2024 01:15:20 +0200 Subject: [PATCH 10/12] fix --- oblt-cli/cluster-create-ccs/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oblt-cli/cluster-create-ccs/action.yml b/oblt-cli/cluster-create-ccs/action.yml index 7651fc29..1e7c25b5 100644 --- a/oblt-cli/cluster-create-ccs/action.yml +++ b/oblt-cli/cluster-create-ccs/action.yml @@ -116,5 +116,5 @@ runs: uses: actions/github-script@v7 with: script: | - const summary = require('${{ github.workspace }}/summary.js') + const summary = require('${{ github.action_path }}/summary.js') await summary({github, context, core}) From 6df6ba03a24f4f93f72cec89e6d510e6ee015c54 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 27 Jun 2024 01:16:28 +0200 Subject: [PATCH 11/12] ok --- oblt-cli/cluster-create-ccs/summary.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oblt-cli/cluster-create-ccs/summary.js b/oblt-cli/cluster-create-ccs/summary.js index c57e5bea..a0133d9a 100644 --- a/oblt-cli/cluster-create-ccs/summary.js +++ b/oblt-cli/cluster-create-ccs/summary.js @@ -4,11 +4,11 @@ module.exports = async ({github, context, core}) => { const clusterInfo = JSON.parse(fs.readFileSync(`${process.env.GITHUB_WORKSPACE}/cluster-info.json`, 'utf8')) const statusUrl = `https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${clusterInfo.ClusterName}` await core.summary - .addHeading('Test Results') + .addHeading('oblt-cli') .addTable([ [{data: 'Cluster Name', header: true}, {data: 'Stack Version', header: true}, {data: 'Status', header: true}], [clusterInfo.ClusterName, clusterInfo.StackVersion, clusterInfo.RemoteClusterName], ]) - .addLink('View staging deployment!', statusUrl) + .addLink('Status', statusUrl) .write() } From 435f122652635744a9e433d9f3fffec64a6f2488 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Thu, 27 Jun 2024 01:19:07 +0200 Subject: [PATCH 12/12] ok --- oblt-cli/cluster-create-ccs/summary.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oblt-cli/cluster-create-ccs/summary.js b/oblt-cli/cluster-create-ccs/summary.js index a0133d9a..7fbd2bf2 100644 --- a/oblt-cli/cluster-create-ccs/summary.js +++ b/oblt-cli/cluster-create-ccs/summary.js @@ -4,7 +4,7 @@ module.exports = async ({github, context, core}) => { const clusterInfo = JSON.parse(fs.readFileSync(`${process.env.GITHUB_WORKSPACE}/cluster-info.json`, 'utf8')) const statusUrl = `https://github.com/elastic/observability-test-environments/pulls?q=is%3Apr+${clusterInfo.ClusterName}` await core.summary - .addHeading('oblt-cli') + .addHeading('oblt-cli', '3') .addTable([ [{data: 'Cluster Name', header: true}, {data: 'Stack Version', header: true}, {data: 'Status', header: true}], [clusterInfo.ClusterName, clusterInfo.StackVersion, clusterInfo.RemoteClusterName],