dubeejw closed pull request #11: removing preinstalled templates
URL: https://github.com/apache/incubator-openwhisk-package-deploy/pull/11
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/packages/actions/deployWeb.js b/packages/actions/deployWeb.js
index 1470f65..2639496 100644
--- a/packages/actions/deployWeb.js
+++ b/packages/actions/deployWeb.js
@@ -39,9 +39,13 @@ function main(params) {
// Extract the name of the repo for the tmp directory
const repoSplit = params.gitUrl.split('/');
const repoName = repoSplit[repoSplit.length - 1];
- const localDirName = `${__dirname}/../tmp/${repoName}`;
- const templatesDirName = `${__dirname}/templates/${repoName}`;
- if (repoSplit[2] === 'github.com' && repoSplit[3] === 'ibm-functions' &&
fs.existsSync(templatesDirName)) {
+ const repoOrg = repoSplit[repoSplit.length - 2];
+ const localDirName = `${__dirname}/../tmp/${repoOrg}/${repoName}`;
+
+ // any pre installed github repos should be a sibling to this package in
"preInstalled" folder
+ const templatesDirName =
`${__dirname}/preInstalled/${repoOrg}/${repoName}`;
+
+ if (fs.existsSync(templatesDirName)) {
resolve({
repoDir: templatesDirName,
manifestPath,
diff --git a/packages/installCatalog.sh b/packages/installCatalog.sh
index 63713d6..e2e91ab 100755
--- a/packages/installCatalog.sh
+++ b/packages/installCatalog.sh
@@ -38,16 +38,6 @@ PACKAGE_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &&
pwd )"
export WSK_CONFIG_FILE= # override local property file to avoid namespace
clashes
-# clone all Templates
-for tmpl in template-hello-world template-cloudant-trigger
template-messagehub-trigger
-do
- if [ -e actions/templates/$tmpl ]
- then
- rm -rf actions/templates/$tmpl
- fi
- git clone --depth 1 https://github.com/ibm-functions/$tmpl
actions/templates/$tmpl
-done
-
# make deployWeb.zip & install
OLD_PATH=`pwd`
cd actions
@@ -58,7 +48,7 @@ if [ -e deployWeb.zip ]
fi
cp -f deployWeb_package.json package.json
-zip -r deployWeb.zip package.json deployWeb.js lib/common.js templates/
+zip -r deployWeb.zip package.json deployWeb.js lib/common.js
../../../preInstalled/
cd $OLD_PATH
diff --git a/tests/src/test/scala/packages/DeployTests.scala
b/tests/src/test/scala/packages/DeployTests.scala
index 346f089..ae082d3 100644
--- a/tests/src/test/scala/packages/DeployTests.scala
+++ b/tests/src/test/scala/packages/DeployTests.scala
@@ -36,7 +36,6 @@ class DeployTests extends TestHelpers
// set parameters for deploy tests
val deployTestRepo =
"https://github.com/apache/incubator-openwhisk-package-deploy"
val incorrectGithubRepo =
"https://github.com/apache/openwhisk-package-deploy-incorrect"
- val malformedRepoUrl = "github.com/ibm-functions/template-hello-world"
val helloWorldPath = "tests/src/test/scala/testFixtures/helloWorld"
val helloWorldWithNoManifest =
"tests/src/stest/scala/testFixtures/helloWorldNoManifest"
val helloWorldPackageParam =
"tests/src/test/scala/testFixtures/helloWorldPackageParam"
@@ -103,18 +102,6 @@ class DeployTests extends TestHelpers
}
}
- // test to create a template with a malformed github repo
- it should "return error if there is a malformed gitUrl provided" in {
- val run = wsk.action.invoke(deployAction, Map(
- "gitUrl" -> malformedRepoUrl.toJson,
- "manifestPath" -> helloWorldPath.toJson))
- withActivation(wsk.activation, run) {
- activation =>
- activation.response.success shouldBe false
- activation.response.result.get.toString should include("There was a
problem cloning from github.")
- }
- }
-
// test to create a template with useless EnvData provided
it should "return succeed if useless envData is provided" in {
val run = wsk.action.invoke(deployAction, Map(
diff --git a/tests/src/test/scala/packages/deployWebTests.scala
b/tests/src/test/scala/packages/deployWebTests.scala
index df574d5..d917f65 100644
--- a/tests/src/test/scala/packages/deployWebTests.scala
+++ b/tests/src/test/scala/packages/deployWebTests.scala
@@ -44,7 +44,6 @@ class DeployWebTests extends TestHelpers
// set parameters for deploy tests
val deployTestRepo =
"https://github.com/apache/incubator-openwhisk-package-deploy"
val incorrectGithubRepo =
"https://github.com/apache/openwhisk-package-deploy-incorrect"
- val malformedRepoUrl = "github.com/ibm-functions/template-hello-world"
val helloWorldPath = "tests/src/test/scala/testFixtures/helloWorld"
val helloWorldWithNoManifest =
"tests/src/test/scala/testFixtures/helloWorldNoManifest"
val helloWorldPackageParam =
"tests/src/test/scala/testFixtures/helloWorldPackageParam"
@@ -118,15 +117,6 @@ class DeployWebTests extends TestHelpers
"wskAuth" -> JsString(wskprops.authKey)
), githubNonExistentStatus, 400)
}
- // test to create a template with a malformed github repo
- it should "return error if there is a malformed gitUrl provided" in {
- makePostCallWithExpectedResult(JsObject(
- "gitUrl" -> JsString(malformedRepoUrl),
- "manifestPath" -> JsString(helloWorldPath),
- "wskApiHost" -> JsString(wskprops.apihost),
- "wskAuth" -> JsString(wskprops.authKey)
- ), githubNonExistentStatus, 400)
- }
// test to create a template with useless EnvData provided
it should "return succeed if useless envData is provided" in {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services