-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(templates): the user can configure a url and ref to fetch templates from #566
Conversation
why use the |
I think it would make more sense for whoever is deploying the chart to just put the URL of the repo - it's not that you usually put API URLs in configuration files. |
True, I will do the change so they only put the repo url. |
67b648d
to
4847955
Compare
Done, now the url should be https://github.com/repos/SwissDataScienceCenter/renku-project-template or similar |
should be just https://github.com/SwissDataScienceCenter/renku-project-template - without the |
4847955
to
de17b8d
Compare
True, I changed it so now it works without the "/repo" part. It will work now assuming that the users put the proper URL. |
de17b8d
to
b783413
Compare
0658b67
to
44c6272
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works for me.
I have just a suggestion: I noted you invoke fetchJson(${<url>}/git/trees/${<template>})
multiple times. It may be a good idea to create a single function and invoke it whenever needed.
return fetchJson(TemplatesReposUrl.TREES_MASTER) | ||
client.getProjectTemplates = (renkuTemplatesUrl, renkuTemplatesRef) => { | ||
const formatedApiURL = getApiURLfromRepoURL(renkuTemplatesUrl); | ||
return fetchJson(`${formatedApiURL}/git/trees/${renkuTemplatesRef}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetchJson(${<url>}/git/trees/${<template>})
--> function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this. If i make a function to call the fetchJson function it will end up looking almost the same, and the exact same case only happens twice since the third case it's with the tree sha and it adds the ?recursive=1 at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it could make sense to have it only in one place so it's easier to understand that they are doing the same thing. The ?recursive=1
could easily be a parameter. Something like this
function getGitTrees(apiUrl, templateUrl, recursive=false) {
let url = `${apiUrl}/git/trees/${templateUrl}`;
if (recursive)
url += "?recursive=1";
return fetchJson(url);
}
Btw I am going to accept the PR as it is, feel free to use the function or not, it's not a big difference 🙂
// Promise which will resolve into the repository sub-tree | ||
// which matches the desired version of the renku project template. | ||
const subTreePromise = fetchJson(TemplatesReposUrl.TREES_MASTER) | ||
const formatedApiURL = getApiURLfromRepoURL(renkuTemplatesUrl); | ||
const subTreePromise = fetchJson(`${formatedApiURL}/git/trees/${renkuTemplatesRef}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetchJson(${<url>}/git/trees/${<template>})
--> function
.then(data => data.tree.filter(obj => obj.path === projectTemplate)[0]['sha']) | ||
.then(treeSha => fetchJson(`${TemplatesReposUrl.TREES}${treeSha}?recursive=1`)); | ||
.then(treeSha => fetchJson(`${formatedApiURL}/git/trees/${treeSha}?recursive=1`)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fetchJson(${<url>}/git/trees/${<template>})
--> function
44c6272
to
1547491
Compare
1a7765b
to
c1db2c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if RENKU_VERSION
is not used anywhere anymore, please remove it from the configuration files and charts
91382c7
to
6262656
Compare
6262656
to
d1136c7
Compare
d1136c7
to
6453ccc
Compare
Addresses #561
I created the branch 'test-branch-manifests' inside our templates project for testing reasons.
In case there is no branch and url configured it fails. Specifications say that default should be master but if there is no URL it will fail anyway unless we want to set the url from our templates project as default along with master.
I had to modify also my public/config.json to make it work, i'm not sure something is missing in the configuration I made. My config file looks like this now (i put it here because is an untracked file):
{
"BASE_URL": "https://virginia.dev.renku.ch",
"GATEWAY_URL": "https://virginia.dev.renku.ch/api",
"WELCOME_PAGE": "IyMgV2VsY29tZSB0byBSZW5rdSB0aHJvdWdoIHRlbGVwcmVzZW5jZQpTb21lIGRlcGxveW1lbnQtc3BlY2lmaWMgaW5mb3JtYXRpb24gd2lsbCBiZSByZWFkIGZyb20gdGhlIHlvdXIgdmFsdWVzLnlhbWwgZmlsZSBhbmQgYmUgZGlzcGxheWVkIGFzIG1hcmtkb3duIGZpbGUuCg==",
"RENKU_VERSION": "latest",
"RENKU_TEMPLATES_URL": "https://github.com/repos/SwissDataScienceCenter/renku-project-template",
"RENKU_TEMPLATES_REF": "test-branch-manifests"
}