Skip to content

Commit

Permalink
feat: init values repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jehoszafat Zimnowoda committed Nov 28, 2023
1 parent 76f2290 commit 456283d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ REDIRECT_URIS='["http://localhost:8084/*","https://auth.dev.gke.otomi.cloud/*","
GITEA_PASSWORD=''
GITEA_URL='http://127.0.0.1:8082'
DRONE_URL='http://127.0.0.1:8081'

OTOMI_VALUES='{"apps":{"argocd":{"enabled":true}},"cluster":{"domainSuffix":"test.localhost"},"teamConfig":{"team-admin":{"selfService":{"apps":[]}}}}'
# Drone task
DRONE_TOKEN=''

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@
"tasks:copy-certs-argo": "node dist/tasks/otomi/copy-certs-argo.js",
"tasks:drone-dev": "ts-node-dev ./src/tasks/drone/drone.ts",
"tasks:drone": "node dist/tasks/drone/drone.js",
"tasks:gitea-dev": "NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node-dev ./src/tasks/gitea/gitea.ts && ts-node-dev ./src/tasks/gitea/gitea-drone-oauth.ts",
"tasks:gitea-dev": "NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node-dev ./src/tasks/gitea/gitea.ts",
"tasks:gitea-drone-auth-dev": "NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node-dev ./src/tasks/gitea/gitea-drone-oauth.ts",
"tasks:gitea-drone-auth": "node dist/tasks/gitea/gitea-drone-oauth.js",
"tasks:gitea": "node dist/tasks/gitea/gitea.js && node dist/tasks/gitea/gitea-drone-oauth.js",
"tasks:gitea": "node dist/tasks/gitea/gitea.js",
"tasks:harbor-dev": "NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node-dev ./src/tasks/harbor/harbor.ts",
"tasks:harbor": "node dist/tasks/harbor/harbor.js",
"tasks:keycloak-dev": "NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node-dev ./src/tasks/keycloak/keycloak.ts",
Expand Down
12 changes: 6 additions & 6 deletions src/tasks/gitea/gitea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function hasSpecificHook(repoApi: RepositoryApi, hookToFind: string): Prom
const hooks: any[] = await doApiCall(
errors,
`Getting hooks in repo "otomi/values"`,
() => repoApi.repoListHooks(orgName, 'values'),
() => repoApi.repoListHooks(orgName, otomiValuesRepoName),
400,
)
if (!hooks) {
Expand Down Expand Up @@ -154,7 +154,7 @@ export async function addTektonHook(repoApi: RepositoryApi): Promise<void> {
errors,
`Adding hook "tekton" to repo otomi/values`,
() =>
repoApi.repoCreateHook(orgName, 'values', {
repoApi.repoCreateHook(orgName, otomiValuesRepoName, {
type: CreateHookOption.TypeEnum.Gitea,
active: true,
config: {
Expand All @@ -175,7 +175,7 @@ export async function deleteDroneHook(repoApi: RepositoryApi): Promise<void> {
if (hasDroneHook.hasHook) {
console.debug('Drone Hook needs to be deleted')
await doApiCall(errors, `Deleting hook "drone" from repo otomi/values`, () =>
repoApi.repoDeleteHook(orgName, 'values', hasDroneHook.id!),
repoApi.repoDeleteHook(orgName, otomiValuesRepoName, hasDroneHook.id!),
)
}
}
Expand Down Expand Up @@ -213,7 +213,7 @@ export default async function main(): Promise<void> {
const repoOption: CreateRepoOption = {
...new CreateRepoOption(),
autoInit: false,
name: otomiValuesRepoName,
name: '',
_private: true,
}
const valuesRepoOption: CreateRepoOption = {
Expand Down Expand Up @@ -242,15 +242,15 @@ export default async function main(): Promise<void> {
await doApiCall(
errors,
`Adding repo values to team otomi-viewer`,
() => repoApi.repoAddTeam(orgName, 'values', 'otomi-viewer'),
() => repoApi.repoAddTeam(orgName, otomiValuesRepoName, 'otomi-viewer'),
422,
)

// add repo: otomi/values to the team: otomi-viewer
await doApiCall(
errors,
`Adding repo values to team otomi-viewer`,
() => repoApi.repoAddTeam(orgName, 'values', 'otomi-viewer'),
() => repoApi.repoAddTeam(orgName, otomiValuesRepoName, 'otomi-viewer'),
422,
)

Expand Down

0 comments on commit 456283d

Please sign in to comment.