Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
shields
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
shields.io
shields
Commits
c2d1cc28
Unverified
Commit
c2d1cc28
authored
2 years ago
by
chris48s
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
deprecate [wercker] service (#8642)
parent
a2751af0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
services/wercker/wercker.service.js
+9
-128
9 additions, 128 deletions
services/wercker/wercker.service.js
services/wercker/wercker.tester.js
+11
-55
11 additions, 55 deletions
services/wercker/wercker.tester.js
with
20 additions
and
183 deletions
services/wercker/wercker.service.js
+
9
−
128
View file @
c2d1cc28
import
Joi
from
'
joi
'
import
{
deprecatedService
}
from
'
../index.js
'
import
{
isBuildStatus
,
renderBuildStatusBadge
}
from
'
../build-status.js
'
import
{
BaseJsonService
}
from
'
../index.js
'
const
werckerSchema
=
Joi
.
array
()
export
default
deprecatedService
({
.
items
(
category
:
'
build
'
,
Joi
.
object
({
route
:
{
result
:
isBuildStatus
,
})
)
.
min
(
0
)
.
max
(
1
)
.
required
()
const
werckerCIDocumentation
=
`
<p>
Note that Wercker badge Key (used in Wercker's native badge urls) is not the same as
the Application Id and the badge key will not work.
</p>
<p>
You can use the Wercker API to locate your Application Id:
<br />
<br />
https://app.wercker.com/api/v3/applications/:username/:applicationName
<br />
For example: https://app.wercker.com/api/v3/applications/wercker/go-wercker-api
<br />
<br />
Your Application Id will be in the 'id' field in the API response.
</p>
`
export
default
class
Wercker
extends
BaseJsonService
{
static
category
=
'
build
'
static
route
=
{
base
:
'
wercker
'
,
base
:
'
wercker
'
,
format
:
pattern
:
'
:various*
'
,
'
(?:(?:ci/)([a-fA-F0-9]{24})|(?:build|ci)/([^/]+/[^/]+?))(?:/(.+?))?
'
,
},
capture
:
[
'
projectId
'
,
'
applicationName
'
,
'
branch
'
],
label
:
'
wercker
'
,
}
dateAdded
:
new
Date
(
'
2022-11-18
'
),
})
static
examples
=
[
{
title
:
'
Wercker CI Run
'
,
pattern
:
'
ci/:applicationId
'
,
namedParams
:
{
applicationId
:
'
559e33c8e982fc615500b357
'
},
staticPreview
:
this
.
render
({
result
:
'
passed
'
}),
documentation
:
werckerCIDocumentation
,
},
{
title
:
'
Wercker CI Run (branch)
'
,
pattern
:
'
ci/:applicationId/:branch
'
,
namedParams
:
{
applicationId
:
'
559e33c8e982fc615500b357
'
,
branch
:
'
master
'
,
},
staticPreview
:
this
.
render
({
result
:
'
passed
'
}),
documentation
:
werckerCIDocumentation
,
},
{
title
:
'
Wercker Build
'
,
pattern
:
'
build/:userName/:applicationName
'
,
namedParams
:
{
userName
:
'
wercker
'
,
applicationName
:
'
go-wercker-api
'
,
},
staticPreview
:
this
.
render
({
result
:
'
passed
'
}),
},
{
title
:
'
Wercker Build (branch)
'
,
pattern
:
'
build/:userName/:applicationName/:branch
'
,
namedParams
:
{
userName
:
'
wercker
'
,
applicationName
:
'
go-wercker-api
'
,
branch
:
'
master
'
,
},
staticPreview
:
this
.
render
({
result
:
'
passed
'
}),
},
]
static
render
({
result
})
{
return
renderBuildStatusBadge
({
status
:
result
})
}
static
getBaseUrl
({
projectId
,
applicationName
})
{
if
(
applicationName
)
{
return
`https://app.wercker.com/api/v3/applications/
${
applicationName
}
/builds`
}
else
{
return
`https://app.wercker.com/api/v3/runs?applicationId=
${
projectId
}
`
}
}
async
fetch
({
projectId
,
applicationName
,
branch
})
{
let
url
const
searchParams
=
{
branch
,
limit
:
1
}
if
(
applicationName
)
{
url
=
`https://app.wercker.com/api/v3/applications/
${
applicationName
}
/builds`
}
else
{
url
=
'
https://app.wercker.com/api/v3/runs
'
searchParams
.
applicationId
=
projectId
}
return
this
.
_requestJson
({
schema
:
werckerSchema
,
url
,
options
:
{
searchParams
},
errorMessages
:
{
401
:
'
private application not supported
'
,
404
:
'
application not found
'
,
},
})
}
async
handle
({
projectId
,
applicationName
,
branch
})
{
const
json
=
await
this
.
fetch
({
projectId
,
applicationName
,
branch
,
})
if
(
json
.
length
===
0
)
{
return
this
.
constructor
.
render
({
result
:
'
not built
'
,
})
}
const
{
result
}
=
json
[
0
]
return
this
.
constructor
.
render
({
result
})
}
}
This diff is collapsed.
Click to expand it.
services/wercker/wercker.tester.js
+
11
−
55
View file @
c2d1cc28
import
{
isBuildStatus
}
from
'
../build-status.js
'
import
{
ServiceTester
}
from
'
../tester.js
'
import
{
createServiceTester
}
from
'
../tester.js
'
export
const
t
=
new
ServiceTester
({
export
const
t
=
await
createServiceTester
()
id
:
'
wercker
'
,
title
:
'
Wercker
'
,
t
.
create
(
'
Build status
'
)
pathPrefix
:
'
/wercker
'
,
.
get
(
'
/build/wercker/go-wercker-api.json
'
)
})
.
expectBadge
({
label
:
'
build
'
,
message
:
isBuildStatus
})
t
.
create
(
'
Build status (deprecated)
'
)
t
.
create
(
'
Build status (with branch)
'
)
.
get
(
'
/build/wercker/go-wercker-api/master.json
'
)
.
expectBadge
({
label
:
'
build
'
,
message
:
isBuildStatus
})
t
.
create
(
'
Build status (application not found)
'
)
.
get
(
'
/build/some-project/that-doesnt-exist.json
'
)
.
expectBadge
({
label
:
'
build
'
,
message
:
'
application not found
'
})
t
.
create
(
'
Build status (private application)
'
)
.
get
(
'
/build/wercker/blueprint.json
'
)
.
expectBadge
({
label
:
'
build
'
,
message
:
'
private application not supported
'
})
t
.
create
(
'
Build passed
'
)
.
get
(
'
/build/wercker/go-wercker-api.json
'
)
.
get
(
'
/build/wercker/go-wercker-api.json
'
)
.
intercept
(
nock
=>
.
expectBadge
({
label
:
'
wercker
'
,
message
:
'
no longer available
'
})
nock
(
'
https://app.wercker.com/api/v3/applications/
'
)
.
get
(
'
/wercker/go-wercker-api/builds?limit=1
'
)
.
reply
(
200
,
[{
status
:
'
finished
'
,
result
:
'
passed
'
}])
)
.
expectBadge
({
label
:
'
build
'
,
message
:
'
passing
'
,
color
:
'
brightgreen
'
,
})
t
.
create
(
'
Build failed
'
)
.
get
(
'
/build/wercker/go-wercker-api.json
'
)
.
intercept
(
nock
=>
nock
(
'
https://app.wercker.com/api/v3/applications/
'
)
.
get
(
'
/wercker/go-wercker-api/builds?limit=1
'
)
.
reply
(
200
,
[{
status
:
'
finished
'
,
result
:
'
failed
'
}])
)
.
expectBadge
({
label
:
'
build
'
,
message
:
'
failing
'
,
color
:
'
red
'
})
t
.
create
(
'
CI status by ID
'
)
.
get
(
'
/ci/559e33c8e982fc615500b357.json
'
)
.
expectBadge
({
label
:
'
build
'
,
message
:
isBuildStatus
})
t
.
create
(
'
CI status by ID (with branch)
'
)
.
get
(
'
/ci/559e33c8e982fc615500b357/master.json
'
)
.
expectBadge
({
label
:
'
build
'
,
message
:
isBuildStatus
})
t
.
create
(
'
CI status
by ID (no runs yet
)
'
)
t
.
create
(
'
CI status
(deprecated
)
'
)
.
get
(
'
/ci/559e33c8e982fc615500b357.json
'
)
.
get
(
'
/ci/559e33c8e982fc615500b357.json
'
)
.
intercept
(
nock
=>
.
expectBadge
({
label
:
'
wercker
'
,
message
:
'
no longer available
'
})
nock
(
'
https://app.wercker.com/api/v3
'
)
.
get
(
'
/runs?applicationId=559e33c8e982fc615500b357&limit=1
'
)
.
reply
(
200
,
[])
)
.
expectBadge
({
label
:
'
build
'
,
message
:
'
not built
'
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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