This repository has been archived by the owner on Mar 3, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maximise compatibility in the tool (#20)
* Write a compatibility test * more parser stuff * Make it ignore small parser errors * Move how this works * add support for a HTTP mirror I wrote for testing * Fixes for this + some fixes to my HTTP mirror * check if dev env * doesn't need to be set * there we goooo, this is more compatible * more stuff 280/282 on the compatibility test boiiiii * Further compatibility things * change where it is commited to * test the do-vue branch I just made * Change to master * Update package-lock.json * fix some bugs * Fix some big issues with rendering * oops * Fixes a bug with printf * Fix the bug that made Jenkins fail * make message clearer * new line here * Make this clearer * just this one env exposed * Update src/kubernetes-tool/utils/helm_parts/document_parser.ts Co-Authored-By: Matt (IPv4) Cowley <me@mattcowley.co.uk> * bug fixes * can now been inline
- Loading branch information
Showing
16 changed files
with
463 additions
and
112 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { fs } from "../utils/helm_parts/utils" | ||
// @ts-ignore | ||
import { HelmCoreParser } from "./helm" | ||
|
||
// Runs the compatibility test. | ||
async function test() { | ||
let errors = "" | ||
let passed = "" | ||
let total = 0 | ||
let works = 0 | ||
const promises = [] | ||
for (const item of await fs.ls("stable")) { | ||
if (!item.file) { | ||
total++ | ||
promises.push(new HelmCoreParser({}, item.path).promise.then(() => { | ||
passed += item.path + "\n" | ||
works++ | ||
}).catch(err => { | ||
errors += `${item.path}: ${err}\n` | ||
})) | ||
} | ||
} | ||
await Promise.all(promises) | ||
console.log(`${works}/${total}\n---\nFailed\n---\n${errors === "" ? "No errors found!\n" : errors}\nPassed\n---\n${passed}`) | ||
} | ||
|
||
// @ts-ignore | ||
window.compatibiltiyTest = test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
Copyright 2019 DigitalOcean | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Defines a very basic filesystem using git-http-mirror. | ||
export default class GitHTTPMirrorFS { | ||
public alias: string | ||
public hostname: string | ||
|
||
// Constructs the class. | ||
public constructor(alias: string, hostname: string) { | ||
this.alias = alias | ||
this.hostname = hostname | ||
} | ||
|
||
// Lists the folder specified. | ||
public async ls(folder: string): Promise<{ | ||
file: boolean; | ||
path: string; | ||
name: string; | ||
}[]> { | ||
const items: { | ||
file: boolean; | ||
path: string; | ||
name: string; | ||
}[] = [] | ||
const res = await fetch(`${this.hostname}/${this.alias}/${folder}`, {headers: { | ||
Accept: "application/json", | ||
}}) | ||
if (res.headers.get("is-dir-listing") === "false") { | ||
return [] | ||
} | ||
const json = await res.json() | ||
for (const item of json) { | ||
const itemResult = await fetch(`${this.hostname}/${this.alias}/${folder}/${item}`) | ||
items.push({ | ||
file: itemResult.headers.get("is-dir-listing") !== "true", | ||
name: item, | ||
path: `${folder}/${item}`, | ||
}) | ||
} | ||
return items | ||
} | ||
|
||
// Gets the item specified. Returns null if it is not found. | ||
public async get(fp: string): Promise<string | undefined> { | ||
const res = await fetch(`${this.hostname}/${this.alias}/${fp}`) | ||
if (!res.ok) return undefined | ||
return await res.text() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/kubernetes-tool/utils/helm_parts/functions/randAlphaNum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Copyright 2019 DigitalOcean | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
export const randAlphaNum = (): string => "<random char (alphabet/number)>" | ||
export const randAlpha = (): string => "<random char (alphabet)>" | ||
export const randNum = (): string => "<random char (number)>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
af00ee1
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.
This commit has been deployed to DigitalOcean Spaces for easy reviewing.