Skip to content

Commit

Permalink
chore: flag to disable harbor core integration on add project
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Aug 23, 2022
1 parent 934f058 commit fb3522d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ STERN_VERSION = 2.1.20
CHART_TESTING_VERSION = v3.6.0
KIND_IMAGE = kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae
TESTS = [nginx,api,features-kubernetes,bulk-deployment,features-kubernetes-2,features-api-variables,active-standby-kubernetes,tasks,drush,drupal-php80,drupal-postgres,python,gitlab,github,bitbucket,node-mongodb,elasticsearch,workflows]
CHARTS_TREEISH = "main"
CHARTS_TREEISH = "harbor-core-disable-in-ci"
TASK_IMAGES = task-activestandby

# Symlink the installed kubectl client if the correct version is already
Expand Down Expand Up @@ -640,7 +640,7 @@ kind/test: kind/cluster helm/repos $(addprefix local-dev/,$(KIND_TOOLS)) $(addpr
&& export IMAGE_REGISTRY="registry.$$(../local-dev/kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}').nip.io:32080/library" \
&& $(MAKE) install-registry HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
&& cd .. && $(MAKE) kind/push-images && cd "$$CHARTSDIR" \
&& $(MAKE) fill-test-ci-values TESTS=$(TESTS) IMAGE_TAG=$(SAFE_BRANCH_NAME) \
&& $(MAKE) fill-test-ci-values TESTS=$(TESTS) IMAGE_TAG=$(SAFE_BRANCH_NAME) DISABLE_CORE_HARBOR=true \
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
Expand Down Expand Up @@ -672,7 +672,7 @@ kind/setup: kind/cluster helm/repos $(addprefix local-dev/,$(KIND_TOOLS)) $(addp
&& export IMAGE_REGISTRY="registry.$$(../local-dev/kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}').nip.io:32080/library" \
&& $(MAKE) install-registry HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
&& cd .. && $(MAKE) -j6 kind/push-images && cd "$$CHARTSDIR" \
&& $(MAKE) fill-test-ci-values TESTS=$(TESTS) IMAGE_TAG=$(SAFE_BRANCH_NAME) \
&& $(MAKE) fill-test-ci-values TESTS=$(TESTS) IMAGE_TAG=$(SAFE_BRANCH_NAME) DISABLE_CORE_HARBOR=true \
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
Expand Down Expand Up @@ -725,7 +725,7 @@ kind/dev: $(addprefix build/,$(KIND_SERVICES))
export KUBECONFIG="$$(realpath ./kubeconfig.kind.$(CI_BUILD_TAG))" \
&& export IMAGE_REGISTRY="registry.$$(./local-dev/kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}').nip.io:32080/library" \
&& $(MAKE) kind/push-images && cd lagoon-charts.kind.lagoon \
&& $(MAKE) install-lagoon-core IMAGE_TAG=$(SAFE_BRANCH_NAME) \
&& $(MAKE) install-lagoon-core IMAGE_TAG=$(SAFE_BRANCH_NAME) DISABLE_CORE_HARBOR=true \
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
Expand Down Expand Up @@ -767,7 +767,7 @@ kind/retest:
export KUBECONFIG="$$(pwd)/kubeconfig.kind.$(CI_BUILD_TAG)" \
&& export IMAGE_REGISTRY="registry.$$(./local-dev/kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}').nip.io:32080/library" \
&& cd lagoon-charts.kind.lagoon \
&& $(MAKE) fill-test-ci-values TESTS=$(TESTS) IMAGE_TAG=$(SAFE_BRANCH_NAME) \
&& $(MAKE) fill-test-ci-values TESTS=$(TESTS) IMAGE_TAG=$(SAFE_BRANCH_NAME) DISABLE_CORE_HARBOR=true \
HELM=$$(realpath ../local-dev/helm) KUBECTL=$$(realpath ../local-dev/kubectl) \
JQ=$$(realpath ../local-dev/jq) \
OVERRIDE_BUILD_DEPLOY_DIND_IMAGE=$$IMAGE_REGISTRY/kubectl-build-deploy-dind:$(SAFE_BRANCH_NAME) \
Expand Down
16 changes: 10 additions & 6 deletions services/api/src/resources/project/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { Sql as sshKeySql } from '../sshKey/sql';
import { createHarborOperations } from './harborSetup';
import sql from '../user/sql';

const DISABLE_CORE_HARBOR = process.env.DISABLE_CORE_HARBOR || "false"

const isAdminCheck = async (hasPermission) => {
try {
// check user is admin
Expand Down Expand Up @@ -416,9 +418,10 @@ export const addProject = async (
}
}

const harborOperations = createHarborOperations(sqlClientPool);

await harborOperations.addProject(project.name, project.id);
if (DISABLE_CORE_HARBOR == "false") {
const harborOperations = createHarborOperations(sqlClientPool);
await harborOperations.addProject(project.name, project.id);
}

userActivityLogger(`User added a project '${project.name}'`, {
project: project.name,
Expand Down Expand Up @@ -475,9 +478,10 @@ export const deleteProject: ResolverFn = async (
}

// @TODO discuss if we want to delete projects in harbor or not
//const harborOperations = createHarborOperations(sqlClientPool);

//const harborResults = await harborOperations.deleteProject(project.name)
// if (DISABLE_CORE_HARBOR == "false") {
// const harborOperations = createHarborOperations(sqlClientPool);
// const harborResults = await harborOperations.deleteProject(project.name)
// }

userActivityLogger(`User deleted a project '${project.name}'`, {
project: project.name,
Expand Down

0 comments on commit fb3522d

Please sign in to comment.