From 533f91e7508db2bf32e3ad8df07119baea2e31f7 Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Tue, 23 Apr 2019 14:02:17 +1000 Subject: [PATCH] add production environment to gitlab project create --- node-packages/commons/src/api.js | 4 +++- services/webhooks2tasks/src/handlers/gitlabProjectCreate.js | 5 ++++- services/webhooks2tasks/src/handlers/gitlabProjectUpdate.js | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/node-packages/commons/src/api.js b/node-packages/commons/src/api.js index 143b4f7f56..ad03ee9ff4 100644 --- a/node-packages/commons/src/api.js +++ b/node-packages/commons/src/api.js @@ -463,16 +463,18 @@ const addProject = ( customer: number, gitUrl: string, openshift: number, + productionenvironment: string, id: ?number = null, ): Promise => graphqlapi.mutate( ` - ($name: String!, $customer: Int!, $gitUrl: String!, $openshift: Int!, $id: Int) { + ($name: String!, $customer: Int!, $gitUrl: String!, $openshift: Int!, $productionenvironment: String!, $id: Int) { addProject(input: { name: $name, customer: $customer, gitUrl: $gitUrl, openshift: $openshift, + productionEnvironment: $productionenvironment, id: $id, }) { ...${projectFragment} diff --git a/services/webhooks2tasks/src/handlers/gitlabProjectCreate.js b/services/webhooks2tasks/src/handlers/gitlabProjectCreate.js index 2a8fbcbe74..936ed6e91a 100644 --- a/services/webhooks2tasks/src/handlers/gitlabProjectCreate.js +++ b/services/webhooks2tasks/src/handlers/gitlabProjectCreate.js @@ -16,6 +16,9 @@ async function gitlabProjectCreate(webhook: WebhookRequestData) { // TODO: figure out openshift id const openshift = 1; + // set production environment to default master + const productionenvironment = "master"; + const meta = { data: project, project: name @@ -34,7 +37,7 @@ async function gitlabProjectCreate(webhook: WebhookRequestData) { return; } - await addProject(name, namespace.id, gitUrl, openshift, id); + await addProject(name, namespace.id, gitUrl, openshift, productionenvironment, id); sendToLagoonLogs( 'info', diff --git a/services/webhooks2tasks/src/handlers/gitlabProjectUpdate.js b/services/webhooks2tasks/src/handlers/gitlabProjectUpdate.js index 923a351b88..416a683ee7 100644 --- a/services/webhooks2tasks/src/handlers/gitlabProjectUpdate.js +++ b/services/webhooks2tasks/src/handlers/gitlabProjectUpdate.js @@ -85,8 +85,11 @@ async function gitlabProjectUpdate(webhook: WebhookRequestData) { // TODO: figure out openshift id const openshift = 1; + // set production environment to default master + const productionenvironment = "master"; + // Project was transferred from a non-group namespace to a group namespace - await addProject(name, namespace.id, gitUrl, openshift, id); + await addProject(name, namespace.id, gitUrl, openshift, productionenvironment, id); sendToLagoonLogs( 'info',