Skip to content

Commit

Permalink
chore: support buildstep in the api too
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Nov 30, 2022
1 parent e973ad3 commit 75c43ca
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ mutation PopulateApi {
UIProject1Environment1addTask1: addTask(
input: {
name: "Site Status"
status: ACTIVE
status: PENDING
environment: 3
service: "cli"
command: "drush status"
Expand All @@ -513,7 +513,7 @@ mutation PopulateApi {
UIProject1Environment1addTask2: addTask(
input: {
name: "Drupal Archive"
status: SUCCEEDED
status: COMPLETE
environment: 3
service: "cli"
command: "drush archive-dump"
Expand Down
2 changes: 1 addition & 1 deletion services/actions-handler/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/cheshir/go-mq v1.2.0
github.com/uselagoon/machinery v0.0.7
github.com/uselagoon/machinery v0.0.8-0.20221129235134-66a9c5a0ca7b
gopkg.in/matryer/try.v1 v1.0.0-20150601225556-312d2599e12e
)

Expand Down
2 changes: 2 additions & 0 deletions services/actions-handler/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ github.com/tiago4orion/conjure v0.0.0-20150908101743-93cb30b9d218/go.mod h1:GQei
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/uselagoon/machinery v0.0.7 h1:fBIURDQRVnaB/Gime1Lfp6kgQYmuQpa0gmdfPwo7dkc=
github.com/uselagoon/machinery v0.0.7/go.mod h1:dGAvkxWQkRu/eLQeWLrTl5HvNoFsiXlXInCptHUxzUw=
github.com/uselagoon/machinery v0.0.8-0.20221129235134-66a9c5a0ca7b h1:8HS79XQIAcxpf11Bamy16QIP8NsMX5d6w3em41NzUaw=
github.com/uselagoon/machinery v0.0.8-0.20221129235134-66a9c5a0ca7b/go.mod h1:dGAvkxWQkRu/eLQeWLrTl5HvNoFsiXlXInCptHUxzUw=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opencensus.io v0.22.0 h1:C9hSCOW830chIVkdja34wa6Ky+IzWllkUinR+BtRZd4=
Expand Down
6 changes: 4 additions & 2 deletions services/actions-handler/handler/controller_builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ func (m *Messenger) handleBuild(ctx context.Context, messageQueue mq.MQ, message
// prepare the deployment patch for later step
statusType := schema.StatusTypes(strings.ToUpper(buildStatus))
updateDeploymentPatch := schema.UpdateDeploymentPatchInput{
RemoteID: &message.Meta.RemoteID,
Status: &statusType,
RemoteID: &message.Meta.RemoteID,
Status: &statusType,
BuildStep: &message.Meta.BuildStep,
// TODO: eventually can handle `message.Meta.BuildStep` here too with API support
}
fmt.Println(message.Meta.BuildStep)
if message.Meta.StartTime != "" {
updateDeploymentPatch.Started = &message.Meta.StartTime
}
Expand Down
6 changes: 3 additions & 3 deletions services/api/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ const resolvers = {
ERROR: 'error',
FAILED: 'failed',
COMPLETE: 'complete',
QUEUED: 'queued',
},
NotificationType: {
SLACK: 'slack',
Expand All @@ -326,10 +327,9 @@ const resolvers = {
RUNNING: 'running',
CANCELLED: 'cancelled',
ERROR: 'error',
COMPLETE: 'complete',
ACTIVE: 'active',
SUCCEEDED: 'succeeded',
FAILED: 'failed',
COMPLETE: 'complete',
QUEUED: 'queued',
},
Openshift: {
projectUser: getProjectUser,
Expand Down
17 changes: 12 additions & 5 deletions services/api/src/resources/deployment/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
pubSub,
createEnvironmentFilteredSubscriber
} from '../../clients/pubSub';
// @ts-ignore
import { getConfigFromEnv, getLagoonRouteFromEnv } from '../../util/config';
import { knex, query, isPatchEmpty } from '../../util/db';
import { Sql } from './sql';
Expand All @@ -31,6 +32,7 @@ import S3 from 'aws-sdk/clients/s3';
import sha1 from 'sha1';
// @ts-ignore
import { generateBuildId } from '@lagoon/commons/dist/util/lagoon';
// @ts-ignore
import { jsonMerge } from '@lagoon/commons/dist/util/func';
import { logger } from '../../loggers/logger';
// @ts-ignore
Expand Down Expand Up @@ -305,7 +307,8 @@ export const addDeployment: ResolverFn = async (
remoteId,
priority,
bulkId,
bulkName
bulkName,
buildStep
}
},
{ sqlClientPool, hasPermission, userActivityLogger }
Expand All @@ -330,7 +333,8 @@ export const addDeployment: ResolverFn = async (
remoteId,
priority,
bulkId,
bulkName
bulkName,
buildStep
})
);

Expand Down Expand Up @@ -381,7 +385,8 @@ export const updateDeployment: ResolverFn = async (
remoteId,
priority,
bulkId,
bulkName
bulkName,
buildStep
}
}
},
Expand Down Expand Up @@ -425,7 +430,8 @@ export const updateDeployment: ResolverFn = async (
remoteId,
priority,
bulkId,
bulkName
bulkName,
buildStep
}
})
);
Expand All @@ -451,7 +457,8 @@ export const updateDeployment: ResolverFn = async (
remoteId,
priority,
bulkId,
bulkName
bulkName,
buildStep
}
}
});
Expand Down
3 changes: 3 additions & 0 deletions services/api/src/resources/deployment/sql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const Sql = {
priority,
bulkId,
bulkName,
buildStep,
}: {
id: number,
name: string,
Expand All @@ -34,6 +35,7 @@ export const Sql = {
priority: number,
bulkId: string,
bulkName: string,
buildStep: string,
}) =>
knex('deployment')
.insert({
Expand All @@ -48,6 +50,7 @@ export const Sql = {
priority,
bulkId,
bulkName,
buildStep,
})
.toString(),
deleteDeployment: (id: number) =>
Expand Down
3 changes: 3 additions & 0 deletions services/api/src/typeDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ const typeDefs = gql`
priority: Int
bulkId: String
bulkName: String
buildStep: String
}
type Insight {
Expand Down Expand Up @@ -1321,6 +1322,7 @@ const typeDefs = gql`
priority: Int
bulkId: String
bulkName: String
buildStep: String
}
input DeleteDeploymentInput {
Expand All @@ -1338,6 +1340,7 @@ const typeDefs = gql`
priority: Int
bulkId: String
bulkName: String
buildStep: String
}
input UpdateDeploymentInput {
Expand Down

0 comments on commit 75c43ca

Please sign in to comment.