From 0cc5c03c3fa4881a871ed58f6b8e8c60c0132a35 Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Tue, 29 Oct 2019 10:58:30 -0400 Subject: [PATCH 1/9] define commands Signed-off-by: Andrew Mak --- codewind.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/codewind.yaml b/codewind.yaml index ae1de3f..fc1b0b2 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -13,7 +13,21 @@ commands: - init - $subtype - none + - name: postRepositoryAdd + command: appsody + args: + - repo + - add + - $id + - $url + - name: postRepositoryRemove + command: appsody + args: + - repo + - remove + - $id detection: .appsody-config.yaml config: containerAppRoot: /project/user-app needsMount: true + style: Appsody From 2cb9e211559af5528ea3d56bf0af5e484c45916b Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Tue, 29 Oct 2019 14:38:24 -0400 Subject: [PATCH 2/9] rename Signed-off-by: Andrew Mak --- codewind.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codewind.yaml b/codewind.yaml index fc1b0b2..a7aa1b9 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -13,14 +13,14 @@ commands: - init - $subtype - none - - name: postRepositoryAdd + - name: onRepositoryAdd command: appsody args: - repo - add - $id - $url - - name: postRepositoryRemove + - name: onRepositoryDelete command: appsody args: - repo From f1c8a515bdfc1489a76a262e60e35bacdff5cfac Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Wed, 30 Oct 2019 15:35:09 -0400 Subject: [PATCH 3/9] add directive Signed-off-by: Andrew Mak --- codewind.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/codewind.yaml b/codewind.yaml index a7aa1b9..91b1305 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -13,13 +13,13 @@ commands: - init - $subtype - none - - name: onRepositoryAdd + - name: onRepositoryAdd command: appsody args: - repo - add - $id - - $url + - $url,.yaml - name: onRepositoryDelete command: appsody args: From 04ebd247c61a4025387194dff0386177dc4351af Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Wed, 30 Oct 2019 16:03:17 -0400 Subject: [PATCH 4/9] rename Signed-off-by: Andrew Mak --- codewind.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codewind.yaml b/codewind.yaml index 91b1305..e6aaf02 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -20,7 +20,7 @@ commands: - add - $id - $url,.yaml - - name: onRepositoryDelete + - name: onRepositoryRemove command: appsody args: - repo From ada54c2fd5c4a7721c91f78601ce955019ea2542 Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Thu, 31 Oct 2019 10:26:50 -0400 Subject: [PATCH 5/9] controller workaround Signed-off-by: Andrew Mak --- entrypoint.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 21417a0..3a4d6ba 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -294,6 +294,15 @@ elif [ "$COMMAND" == "rebuild" ]; then create # Just return configuration information as last line of output else + # a temporary workaround until controller mount is no longer needed + if [ "$IN_K8" != "true" ]; then + tempBin="/mounted-workspace/.extensions/$EXT_NAME/bin" + if [ ! -f "$tempBin/appsody-controller" ]; then + mkdir -p $tempBin + cp "$DIR/bin/appsody-controller" $tempBin + fi + fi + stack=`grep "stack: " .appsody-config.yaml` knStack=`$DIR/scripts/get-stack.sh "$stack"` echo -n "{ \"language\": \"$knStack\" }" > $LOG_FOLDER/settings.json From e11428b4c6449cd17a4691962d71c8cb745c3357 Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Fri, 1 Nov 2019 10:13:33 -0400 Subject: [PATCH 6/9] pulling in 0.4.8 Signed-off-by: Andrew Mak --- bin/README.md | 4 ++-- bin/pull.sh | 4 ++-- templatesProvider.js | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/bin/README.md b/bin/README.md index f4ddc48..3372fc2 100755 --- a/bin/README.md +++ b/bin/README.md @@ -2,5 +2,5 @@ This Codewind Appsody extension includes the following releases of the Appsody executables: -- Appsody: [0.4.7](https://github.com/appsody/appsody/releases/tag/0.4.7) -- Appsody controller: [0.2.5](https://github.com/appsody/controller/releases/tag/0.2.5) +- Appsody: [0.4.8](https://github.com/appsody/appsody/releases/tag/0.4.8) +- Appsody controller: [0.2.6](https://github.com/appsody/controller/releases/tag/0.2.6) diff --git a/bin/pull.sh b/bin/pull.sh index b80b940..e1ea012 100755 --- a/bin/pull.sh +++ b/bin/pull.sh @@ -3,8 +3,8 @@ set -e set -o pipefail -default_appsody_version=0.4.7 -default_appsody_controller_version=0.2.5 +default_appsody_version=0.4.8 +default_appsody_controller_version=0.2.6 appsody_version=${APPSODY_VERSION} appsody_controller_version=${APPSODY_CONTROLLER_VERSION} diff --git a/templatesProvider.js b/templatesProvider.js index 6ac1bd2..f4f2c94 100755 --- a/templatesProvider.js +++ b/templatesProvider.js @@ -72,14 +72,11 @@ module.exports = { const projectTypes = []; - const result = await exec(`${__dirname}/appsody list -o json`); + const result = await exec(`${__dirname}/appsody list ${id} -o json`); const json = JSON.parse(result.stdout); for (const repo of json.repositories) { - - if (repo.repositoryName == 'experimental') - continue; - + for (const stack of repo.stacks) { projectTypes.push({ From 8d362b3f33050a49d281fddcc139bd5e154153e7 Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Fri, 1 Nov 2019 10:36:11 -0400 Subject: [PATCH 7/9] backout some change Signed-off-by: Andrew Mak --- codewind.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/codewind.yaml b/codewind.yaml index e6aaf02..69908b6 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -13,19 +13,6 @@ commands: - init - $subtype - none - - name: onRepositoryAdd - command: appsody - args: - - repo - - add - - $id - - $url,.yaml - - name: onRepositoryRemove - command: appsody - args: - - repo - - remove - - $id detection: .appsody-config.yaml config: containerAppRoot: /project/user-app From 7f241e5b7c41b6416d8d49ec6d86ed8ee7cf88d3 Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Fri, 1 Nov 2019 10:37:20 -0400 Subject: [PATCH 8/9] back out a change Signed-off-by: Andrew Mak --- codewind.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/codewind.yaml b/codewind.yaml index 69908b6..ae1de3f 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -17,4 +17,3 @@ detection: .appsody-config.yaml config: containerAppRoot: /project/user-app needsMount: true - style: Appsody From 5ffb5e6d9e6ceb8d819fdaf539ca9d25efd0a37f Mon Sep 17 00:00:00 2001 From: Andrew Mak Date: Fri, 1 Nov 2019 12:18:01 -0400 Subject: [PATCH 9/9] commands + better guarding Signed-off-by: Andrew Mak --- codewind.yaml | 14 ++++++++ templatesProvider.js | 78 +++++++++++++++++++++++++------------------- 2 files changed, 59 insertions(+), 33 deletions(-) diff --git a/codewind.yaml b/codewind.yaml index ae1de3f..e6aaf02 100755 --- a/codewind.yaml +++ b/codewind.yaml @@ -13,7 +13,21 @@ commands: - init - $subtype - none + - name: onRepositoryAdd + command: appsody + args: + - repo + - add + - $id + - $url,.yaml + - name: onRepositoryRemove + command: appsody + args: + - repo + - remove + - $id detection: .appsody-config.yaml config: containerAppRoot: /project/user-app needsMount: true + style: Appsody diff --git a/templatesProvider.js b/templatesProvider.js index f4f2c94..11a5ff5 100755 --- a/templatesProvider.js +++ b/templatesProvider.js @@ -43,27 +43,33 @@ module.exports = { getRepositories: async function() { const repos = []; - - const result = await exec(`${__dirname}/appsody repo list -o json`); - const json = JSON.parse(result.stdout); + + try { + const result = await exec(`${__dirname}/appsody repo list -o json`); + const json = JSON.parse(result.stdout); - for (const repo of json.repositories) { + for (const repo of json.repositories) { - const name = repo.name; - let url = repo.url; + const name = repo.name; + let url = repo.url; - if (name != 'experimental' && url.endsWith('index.yaml')) { + if (name != 'experimental' && url.endsWith('index.yaml')) { - url = url.substring(0, url.length - 10) + 'index.json'; + url = url.substring(0, url.length - 10) + 'index.json'; - repos.push({ - id: name, - name: `Appsody Stacks - ${name}`, - description: 'Use Appsody in Codewind to develop applications with sharable technology stacks.', - url - }); + repos.push({ + id: name, + name: `Appsody Stacks - ${name}`, + description: 'Use Appsody in Codewind to develop applications with sharable technology stacks.', + url + }); + } } } + catch (err) { + console.error('Appsody extension: failed to retrieve repositories'); + console.error(err.message); + } return repos; }, @@ -72,27 +78,33 @@ module.exports = { const projectTypes = []; - const result = await exec(`${__dirname}/appsody list ${id} -o json`); - const json = JSON.parse(result.stdout); - - for (const repo of json.repositories) { - - for (const stack of repo.stacks) { - - projectTypes.push({ - projectType: 'appsodyExtension', - projectSubtypes: { - label: 'Appsody stack', - items: [{ - id: `${repo.repositoryName}/${stack.id}`, - version: stack.version, - label: `Appsody ${stack.id}`, - description: stack.description - }] - } - }); + try { + const result = await exec(`${__dirname}/appsody list ${id} -o json`); + const json = JSON.parse(result.stdout); + + for (const repo of json.repositories) { + + for (const stack of repo.stacks) { + + projectTypes.push({ + projectType: 'appsodyExtension', + projectSubtypes: { + label: 'Appsody stack', + items: [{ + id: `${repo.repositoryName}/${stack.id}`, + version: stack.version, + label: `Appsody ${stack.id}`, + description: stack.description + }] + } + }); + } } } + catch (err) { + console.error('Appsody extension: failed to retrieve project types'); + console.error(err.message); + } return projectTypes; }