Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flux-gitlab-syncer
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
12
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IT Common Platform
platform-support
apps
flux-gitlab-syncer
Commits
18d2945b
Commit
18d2945b
authored
1 year ago
by
Joshua David Akers
Browse files
Options
Downloads
Plain Diff
Merge branch '
PLATFORM-2172
-webhook' into 'main'
PLATFORM-2172
- webhook, api version See merge request
!37
parents
2ff7400e
29ec9b19
1 merge request
!37
PLATFORM-2172 - webhook, api version
Pipeline
#1001144
failed with stages
Stage:
Stage:
in 1 minute and 56 seconds
Changes
3
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/syncers/webhookSyncer.js
+2
-2
2 additions, 2 deletions
src/syncers/webhookSyncer.js
test/syncers/events/receiver.json
+2
-2
2 additions, 2 deletions
test/syncers/events/receiver.json
test/syncers/webhookSyncer.spec.js
+3
-3
3 additions, 3 deletions
test/syncers/webhookSyncer.spec.js
with
7 additions
and
7 deletions
src/syncers/webhookSyncer.js
+
2
−
2
View file @
18d2945b
...
...
@@ -5,7 +5,7 @@ const Util = require("../util");
const
WEBHOOK_SYNCED_ANNOTATION
=
"
platform.it.vt.edu/webhook-synced
"
;
const
PROJECT_PATH_ANNOTATION
=
"
platform.it.vt.edu/webhook-sync-project
"
;
const
API_GROUP
=
"
notification.toolkit.fluxcd.io
"
;
const
API_VERSION
=
"
v1
beta1
"
;
const
API_VERSION
=
"
v1
"
;
const
KIND_PLURAL
=
"
receivers
"
;
function
WebhookSyncer
(
k8sClient
,
webhookBaseUrl
,
gitLabClient
)
{
...
...
@@ -42,7 +42,7 @@ WebhookSyncer.prototype.onEvent = async function (eventType, receiver) {
if
(
eventType
!==
"
DELETED
"
&&
receiver
.
metadata
.
annotations
&&
receiver
.
metadata
.
annotations
[
WEBHOOK_SYNCED_ANNOTATION
])
return
;
if
(
!
receiver
.
status
||
!
receiver
.
status
.
webhookPath
)
{
return
logger
.
warn
(
`Receiver
${
receiver
.
metadata
.
name
}
doesn't have status or is missing webhookPath.`
);
return
logger
.
warn
(
`Receiver
${
receiver
.
metadata
.
name
}
doesn't have status or is missing webhookPath.
status:
${
receiver
.
status
}
`
);
}
if
(
receiver
.
spec
.
resources
.
length
!==
1
)
{
...
...
This diff is collapsed.
Click to expand it.
test/syncers/events/receiver.json
+
2
−
2
View file @
18d2945b
{
"apiVersion"
:
"notification.toolkit.fluxcd.io/v1
beta2
"
,
"apiVersion"
:
"notification.toolkit.fluxcd.io/v1"
,
"kind"
:
"Receiver"
,
"metadata"
:
{
"annotations"
:
{
...
...
@@ -20,7 +20,7 @@
],
"resources"
:
[
{
"apiVersion"
:
"source.toolkit.fluxcd.io/v1
beta1
"
,
"apiVersion"
:
"source.toolkit.fluxcd.io/v1"
,
"kind"
:
"GitRepository"
,
"name"
:
"test"
}
...
...
This diff is collapsed.
Click to expand it.
test/syncers/webhookSyncer.spec.js
+
3
−
3
View file @
18d2945b
...
...
@@ -112,7 +112,7 @@ describe("event handling", () => {
expect
(
k8sClient
.
getSecretData
).
toHaveBeenCalled
();
expect
(
k8sClient
.
getCustomResource
).
toHaveBeenCalledWith
(
"
source.toolkit.fluxcd.io
"
,
"
v1
beta1
"
,
"
v1
"
,
"
gitrepositories
"
,
"
test
"
);
...
...
@@ -125,7 +125,7 @@ describe("event handling", () => {
expect
(
k8sClient
.
addAnnotationsToCustomObject
).
toHaveBeenCalledWith
(
"
notification.toolkit.fluxcd.io
"
,
"
v1
beta1
"
,
"
v1
"
,
"
receivers
"
,
"
test
"
,
"
325926
"
,
...
...
@@ -149,7 +149,7 @@ describe("event handling", () => {
expect
(
k8sClient
.
addAnnotationsToCustomObject
).
toHaveBeenCalledWith
(
"
notification.toolkit.fluxcd.io
"
,
"
v1
beta1
"
,
"
v1
"
,
"
receivers
"
,
"
test
"
,
"
325926
"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment