Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove support level label feature #284

Merged
merged 19 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,16 +643,6 @@ For example:
{"post-generic-pr-support-comments":false}
```

### Support labels

`vip-go-ci` can put labels on pull requests indicating level of support provided. With this feature configured, `vip-go-ci` will attach a label to every new pull request that does not have it. For this to work, it will need access to a `repo-meta API` that needs to be available and `vip-go-ci` has to be configured to work with.

This feature can be used in the following way:

> ./vip-go-ci.php --set-support-level-label=true --set-support-level-field="support-level" --repo-meta-api-base-url="http://myrepometa-api.mycompany.is" --repo-meta-api-user-id=7334005 --repo-meta-api-access-token="MY-TOKEN"

Note that by default, all support level labels have a prefix: `[Support Level]`. This can be changed by using the `--set-support-level-label-prefix` option.

### IRC support

`vip-go-ci` supports posting certain logged messages to a HTTP API that will eventually relay the information to a IRC channel. This can of course be any IRC-like system, as long as the HTTP API behaves the same. This is useful if you need to have some information submitted to a monitoring system, for instance.
Expand Down Expand Up @@ -749,8 +739,8 @@ repo-meta-api-user-id= ; User ID for the meta API
repo-meta-api-access-token= ; Access token for the meta API
repo-owner= ; Repository owner for the test, should be found in meta API
repo-name= ; Repository name for the test
support-level= ; Name of support level given by meta API
support-level-field-name= ; Support level field name in meta API
support-level= ; Name of support level given by meta API (only used in tests)
support-level-field-name= ; Support level field name in meta API (only used in tests)
```

This file is not included, and needs to be configured manually.
Expand Down
67 changes: 0 additions & 67 deletions main.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,6 @@ function vipgoci_help_print() :void {
"\t" . ' matches the criteria specified here.' . PHP_EOL .
"\t" . ' See README.md for usage.' . PHP_EOL .
PHP_EOL .
'Support level configuration:' . PHP_EOL .
"\t" . '--set-support-level-label=BOOL Whether to attach support level labels to pull requests.' . PHP_EOL .
"\t" . ' Will fetch information on support levels from repo-meta API.' . PHP_EOL .
"\t" . '--set-support-level-label-prefix=STRING Prefix to use for support level labels. Should be longer than five letters.' . PHP_EOL .
"\t" . '--set-support-level-field=STRING Field in responses from repo-meta API which we use to extract support level.' . PHP_EOL .
PHP_EOL .
'Repo meta API configuration:' . PHP_EOL .
"\t" . '--repo-meta-api-base-url=STRING Base URL to repo-meta API, containing support level and other' . PHP_EOL .
"\t" . ' information.' . PHP_EOL .
Expand Down Expand Up @@ -332,13 +326,6 @@ function vipgoci_options_recognized() :array {
'post-generic-pr-support-comments-branches:',
'post-generic-pr-support-comments-repo-meta-match:',

/*
* Support level configuration
*/
'set-support-level-label:',
'set-support-level-label-prefix:',
'set-support-level-field:',

/*
* Repo meta API configuration.
*/
Expand Down Expand Up @@ -1673,50 +1660,6 @@ function vipgoci_run_cleanup_irc( array &$options ) :void {
*/
}

/**
* Set support level label options.
*
* @param array $options Array of options.
*
* @return void
*/
function vipgoci_run_init_options_set_support_level_label(
array &$options
) :void {
/*
* Handle option for setting support
* labels. Handle prefix and field too.
*/

vipgoci_option_bool_handle(
$options,
'set-support-level-label',
'false'
);

if (
( isset( $options['set-support-level-label-prefix'] ) ) &&
( strlen( $options['set-support-level-label-prefix'] ) > 5 )
) {
$options['set-support-level-label-prefix'] = trim(
$options['set-support-level-label-prefix']
);
} else {
$options['set-support-level-label-prefix'] = null;
}

if (
( isset( $options['set-support-level-field'] ) ) &&
( strlen( $options['set-support-level-field'] ) > 1 )
) {
$options['set-support-level-field'] = trim(
$options['set-support-level-field']
);
} else {
$options['set-support-level-field'] = null;
}
}

/**
* Set repo-meta API options.
*
Expand Down Expand Up @@ -2106,9 +2049,6 @@ function vipgoci_run_init_options(
// Set options relating to generic PR support comments.
vipgoci_run_init_options_post_generic_pr_support_comments( $options );

// Set options relating to support level labels.
vipgoci_run_init_options_set_support_level_label( $options );

// Set options relating to the repo-meta API.
vipgoci_run_init_options_repo_meta_api( $options );

Expand Down Expand Up @@ -2731,13 +2671,6 @@ function vipgoci_run_scan(
$prs_implicated
);

/*
* Add support level label, if:
* - configured to do so
* - data is available in repo-meta API
*/
vipgoci_support_level_label_set( $options );

if ( true === $options['phpcs'] ) {
/*
* Verify that sniffs specified on command line
Expand Down
Loading