Skip to content

Commit

Permalink
feat: add sonar badge to pipeline (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
adong authored Oct 21, 2023
1 parent a48e017 commit 9216862
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 15 additions & 1 deletion models/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ const Parameters = require('../config/parameters');
const mutate = require('../lib/mutate');

const STATES = ['ACTIVE', 'INACTIVE'];
const BADGE = Joi.object({
name: Joi.string().max(128).description('The dashboard name for a badge').example('screwdriver/ui'),
uri: Joi.string()
.max(500)
.description('Unique identifier for the badge application dashboard')
.example('https://sonar.screwdriver.cd/dashboard?id=112233')
});

const CREATE_MODEL = {
checkoutUrl: Joi.string()
Expand Down Expand Up @@ -90,7 +97,14 @@ const MODEL = {
actions: Joi.array().items(Joi.string())
})
)
.description('List of subscribed scm urls paired with actions')
.description('List of subscribed scm urls paired with actions'),

badges: Joi.object({
sonar: BADGE
})
.description('A list of badges that pipline has')
.example(`{ sonar: { name: 'dashboard', uri: 'http://sonar.com/sample1' } }`)
.optional()
};

const UPDATE_MODEL = { ...CREATE_MODEL, settings: MODEL.settings };
Expand Down
4 changes: 4 additions & 0 deletions test/data/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ scmRepo:
branch: master
url: https://github.com/screwdriver-cd/screwdriver/tree/master
state: ACTIVE
badges:
sonar:
name: screwdriver-cd/screwdriver
uri: https://sonar.screwdriver.cd/dashboard?id=123123

0 comments on commit 9216862

Please sign in to comment.