Skip to content

Commit a9db46b

Browse files
authored
Google Drive Integration (#2443)
* schema output, migrations, new drive integration * new migrations * injector context * PR feedback
1 parent 8314316 commit a9db46b

119 files changed

Lines changed: 11840 additions & 792 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
444dd3c4839216a2f0e7e9a88418e374
1+
3dd9c62b4e63c98f283e1895d8c72356

common/enums/documentmanagementmode.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ var (
1616
// DocumentManagementModeExternalReference indicates the document is uploaded as a viewable
1717
// reference while being managed in an external editor (such as Microsoft Word).
1818
DocumentManagementModeExternalReference DocumentManagementMode = "EXTERNAL_REFERENCE"
19+
// DocumentManagementModeIntegration is used when the document is managed by an external system integrated with Openlane.
20+
DocumentManagementModeIntegration DocumentManagementMode = "INTEGRATION"
1921
// DocumentManagementModeInvalid is used when an unknown or unsupported value is provided.
2022
DocumentManagementModeInvalid DocumentManagementMode = "DOCUMENT_MANAGEMENT_MODE_INVALID"
2123
)
2224

2325
var documentManagementModeValues = []DocumentManagementMode{
2426
DocumentManagementModeOpenlaneManaged,
2527
DocumentManagementModeExternalReference,
28+
DocumentManagementModeIntegration,
2629
}
2730

2831
// Values returns a slice of strings representing all valid DocumentManagementMode values.

config/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ CORE_INTEGRATIONS_SLACK_APPID=""
280280
CORE_INTEGRATIONS_SLACKRUNTIME_WEBHOOKURL=""
281281
CORE_INTEGRATIONS_SLACKRUNTIME_BOTTOKEN=""
282282
CORE_INTEGRATIONS_SLACKRUNTIME_DEFAULTCHANNEL=""
283+
CORE_INTEGRATIONS_GOOGLEDRIVE_CLIENTID=""
284+
CORE_INTEGRATIONS_GOOGLEDRIVE_CLIENTSECRET=""
285+
CORE_INTEGRATIONS_GOOGLEDRIVE_REDIRECTURL="https://api.theopenlane.io/v1/integrations/auth/callback"
283286
CORE_INTEGRATIONS_GOOGLEWORKSPACE_CLIENTID=""
284287
CORE_INTEGRATIONS_GOOGLEWORKSPACE_CLIENTSECRET=""
285288
CORE_INTEGRATIONS_GOOGLEWORKSPACE_REDIRECTURL="https://api.theopenlane.io/v1/integrations/auth/callback"

config/config.example.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ integrations:
165165
appslug: ""
166166
privatekey: ""
167167
webhooksecret: ""
168+
googledrive:
169+
clientid: ""
170+
clientsecret: ""
171+
redirecturl: https://api.theopenlane.io/v1/integrations/auth/callback
168172
googleworkspace:
169173
clientid: ""
170174
clientsecret: ""

config/configmap-config-file.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,15 @@ data:
995995
defaultChannel: {{ .Values.openlane.coreConfiguration.integrations.slackruntime.defaultChannel | quote }}
996996
{{- end }}
997997
{{- end }}
998+
{{- if .Values.openlane.coreConfiguration.integrations.googledrive }}
999+
googledrive:
1000+
{{- if .Values.openlane.coreConfiguration.integrations.googledrive.clientid }}
1001+
clientid: {{ .Values.openlane.coreConfiguration.integrations.googledrive.clientid | quote }}
1002+
{{- end }}
1003+
{{- if .Values.openlane.coreConfiguration.integrations.googledrive.redirecturl }}
1004+
redirecturl: {{ .Values.openlane.coreConfiguration.integrations.googledrive.redirecturl | quote }}
1005+
{{- end }}
1006+
{{- end }}
9981007
{{- if .Values.openlane.coreConfiguration.integrations.googleworkspace }}
9991008
googleworkspace:
10001009
{{- if .Values.openlane.coreConfiguration.integrations.googleworkspace.clientid }}

config/helm-values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@ coreConfiguration:
528528
botToken: "" # @schema type:string
529529
# -- Default channel id for system messages when no explicit channel is provided
530530
defaultChannel: "" # @schema type:string
531+
googledrive:
532+
clientid: "" # @schema type:string
533+
redirecturl: "https://api.theopenlane.io/v1/integrations/auth/callback" # @schema type:string; default:https://api.theopenlane.io/v1/integrations/auth/callback
531534
googleworkspace:
532535
clientid: "" # @schema type:string
533536
redirecturl: "https://api.theopenlane.io/v1/integrations/auth/callback" # @schema type:string; default:https://api.theopenlane.io/v1/integrations/auth/callback
@@ -943,6 +946,14 @@ externalSecrets:
943946
secretKey: "CORE_INTEGRATIONS_SLACK_CLIENTSECRET" # @schema type:string
944947
# -- Remote key in GCP Secret Manager
945948
remoteKey: "core-integrations-slack-clientsecret" # @schema type:string
949+
# -- core-integrations-googledrive-clientsecret secret configuration
950+
core-integrations-googledrive-clientsecret:
951+
# -- Enable this external secret
952+
enabled: true # @schema type:boolean; default:true
953+
# -- Environment variable key for integrations.googledrive.clientsecret
954+
secretKey: "CORE_INTEGRATIONS_GOOGLEDRIVE_CLIENTSECRET" # @schema type:string
955+
# -- Remote key in GCP Secret Manager
956+
remoteKey: "core-integrations-googledrive-clientsecret" # @schema type:string
946957
# -- core-integrations-googleworkspace-clientsecret secret configuration
947958
core-integrations-googleworkspace-clientsecret:
948959
# -- Enable this external secret
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- +goose Up
2+
-- modify "action_plans" table
3+
ALTER TABLE "action_plans" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
4+
-- modify "procedures" table
5+
ALTER TABLE "procedures" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
6+
-- modify "internal_policies" table
7+
ALTER TABLE "internal_policies" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
8+
-- create "integration_internal_policies" table
9+
CREATE TABLE "integration_internal_policies" ("integration_id" character varying NOT NULL, "internal_policy_id" character varying NOT NULL, PRIMARY KEY ("integration_id", "internal_policy_id"), CONSTRAINT "integration_internal_policies_integration_id" FOREIGN KEY ("integration_id") REFERENCES "integrations" ("id") ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT "integration_internal_policies_internal_policy_id" FOREIGN KEY ("internal_policy_id") REFERENCES "internal_policies" ("id") ON UPDATE NO ACTION ON DELETE CASCADE);
10+
11+
-- +goose Down
12+
-- reverse: create "integration_internal_policies" table
13+
DROP TABLE "integration_internal_policies";
14+
-- reverse: modify "internal_policies" table
15+
ALTER TABLE "internal_policies" DROP COLUMN "external_contents", DROP COLUMN "external_file_id";
16+
-- reverse: modify "procedures" table
17+
ALTER TABLE "procedures" DROP COLUMN "external_contents", DROP COLUMN "external_file_id";
18+
-- reverse: modify "action_plans" table
19+
ALTER TABLE "action_plans" DROP COLUMN "external_contents", DROP COLUMN "external_file_id";
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- +goose Up
2+
-- modify "action_plan_history" table
3+
ALTER TABLE "action_plan_history" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
4+
-- modify "internal_policy_history" table
5+
ALTER TABLE "internal_policy_history" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
6+
-- modify "procedure_history" table
7+
ALTER TABLE "procedure_history" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
8+
9+
-- +goose Down
10+
-- reverse: modify "procedure_history" table
11+
ALTER TABLE "procedure_history" DROP COLUMN "external_contents", DROP COLUMN "external_file_id";
12+
-- reverse: modify "internal_policy_history" table
13+
ALTER TABLE "internal_policy_history" DROP COLUMN "external_contents", DROP COLUMN "external_file_id";
14+
-- reverse: modify "action_plan_history" table
15+
ALTER TABLE "action_plan_history" DROP COLUMN "external_contents", DROP COLUMN "external_file_id";

db/migrations-goose-postgres/atlas.sum

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
h1:bdYTMDSsq0r1koYBwcvUCTg4ay4vY+xQHDf1hVlrp6A=
1+
h1:RBrbP1pM3i4A0ol0Dgn3cP85BcYrfgupt8i4BdpQ/zE=
22
20251229183203_init.sql h1:g/05irCXoqKFObJV2PPLuvDRqma+da41VPsZ5fXQgfE=
33
20251229183205_init_history.sql h1:P/q2kAHb8zfNMOWzYkKtPbOwoh9GdJUQljSNAiPEjYI=
44
20251231045229_workflow.sql h1:uUPRLO4yw2y//fPGeqIXRrL+fiEN1TRGkF4wHiqPaPk=
@@ -136,3 +136,5 @@ h1:bdYTMDSsq0r1koYBwcvUCTg4ay4vY+xQHDf1hVlrp6A=
136136
20260525161846_remove_dedicated_db.sql h1:AWuCvcgel7Bz+GrZz2x+pQ8kVTzoRKKXGW4LoJNB7nw=
137137
20260525161851_remove_dedicated_db_history.sql h1:8wQkTCs5n7cWLfI4d1DtsO/t7IWbMBsVNQz5uh2cUh4=
138138
20260526053031_perms_revamp.sql h1:JgXPG8gy+GaA06SRcrF1dePB8LwRVwwUkFctnK5GouU=
139+
20260529171325_googledriveintegration.sql h1:rO9KmB9DdRIbmdCr+P6JsMkFpA3esIK9RzocSWYB7aA=
140+
20260529171329_googledriveintegration_history.sql h1:Ij8rZgP/CoZRjFXVR5YTR24MwuyroRHVFuuODhYiL/g=
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Modify "action_plans" table
2+
ALTER TABLE "action_plans" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
3+
-- Modify "procedures" table
4+
ALTER TABLE "procedures" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
5+
-- Modify "internal_policies" table
6+
ALTER TABLE "internal_policies" ADD COLUMN "external_file_id" character varying NULL, ADD COLUMN "external_contents" character varying NULL;
7+
-- Create "integration_internal_policies" table
8+
CREATE TABLE "integration_internal_policies" ("integration_id" character varying NOT NULL, "internal_policy_id" character varying NOT NULL, PRIMARY KEY ("integration_id", "internal_policy_id"), CONSTRAINT "integration_internal_policies_integration_id" FOREIGN KEY ("integration_id") REFERENCES "integrations" ("id") ON UPDATE NO ACTION ON DELETE CASCADE, CONSTRAINT "integration_internal_policies_internal_policy_id" FOREIGN KEY ("internal_policy_id") REFERENCES "internal_policies" ("id") ON UPDATE NO ACTION ON DELETE CASCADE);

0 commit comments

Comments
 (0)