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

feat: add Java sample app dependency #5153

Merged
merged 7 commits into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 15 additions & 3 deletions packages/auto-approve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ processes:
- "GoDependency"
- "GoApiaryCodegen"
- "PythonSampleAppDependency"
- "JavaSampleAppDependency"
```

These seven processes represent different workflows for what auto-approve will approve and merge in a given repository. To see their logic in full, see the corresponding file in /src/process-checks.
Expand Down Expand Up @@ -108,12 +109,12 @@ Below is what each process checks for:
- Checks that the title of the PR matches the regexp: /^(fix|chore)\(deps\): update dependency (@?\S*) to v(\S*)$/
- Max 50 files changed in the PR
- Each file path must match one of these regexps:
- /pom.xml$/
- /pom.xml$/ or /build.gradle$/
- All files must:
- Match this regexp: /pom.xml$/
- Match this regexp: /pom.xml$/ or /build.gradle$/
- Increase the non-major package version of a dependency
- Only change one dependency
- Change the dependency that was there previously, and that is on the title of the PR, and is a Google dependency
- Change the dependency that was there previously, and that is on the title of the PR, and is a Google or grpc dependency
* OwlBotTemplateChanges:
- Checks that the author is 'gcf-owl-bot[bot]'
- Checks that the title of the PR does NOT include feat, fix, or !
Expand Down Expand Up @@ -163,6 +164,17 @@ Below is what each process checks for:
- Match this regexp: /requirements.txt$/ or /requirements\.in$/
- Increase the non-major package version of a dependency or digest
- Change the dependency that was there previously, and that is on the title of the PR
* JavaSampleAppDependency:
- Checks that the author is 'renovate-bot'
- Checks that the title of the PR matches the regexp: /^(fix|chore)\(deps\): update dependency (@?\S*) to v(\S*)$/
- Max 50 files changed in the PR
- Each file path must match one of these regexps:
- /pom.xml$/
- All files must:
- Match this regexp: /pom.xml$/
- Increase the non-major package version of a dependency
- Only change one dependency
- Change the dependency that was there previously, and that is on the title of the PR



Expand Down
240 changes: 120 additions & 120 deletions packages/auto-approve/__snapshots__/auto-approve.test.js
Original file line number Diff line number Diff line change
@@ -1,185 +1,185 @@
exports['auto-approve main auto-approve function config exists on main branch approves and tags a PR if a config exists & is valid & PR is valid 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch approves and tags a PR if a config exists & is valid & PR is valid 2'] = {
'event': 'APPROVE'
"event": "APPROVE"
}

exports['auto-approve main auto-approve function config exists on main branch does nothing if there is already an approval 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch approves and tags a PR if everything is valid, and it is coming from a fork 1'] = {
'head_sha': '65f14b92a8135948008c6e26344167a2dac9f066',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "65f14b92a8135948008c6e26344167a2dac9f066",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch approves and tags a PR if everything is valid, and it is coming from a fork 2'] = {
'event': 'APPROVE'
"event": "APPROVE"
}

exports['auto-approve main auto-approve function config exists on main branch retries if etag is not current 1'] = {
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch retries if etag is not current 2'] = {
"event": "APPROVE"
}

exports['auto-approve main auto-approve function config exists on main branch stops retrying to add the label after 3 attempts, even if it is never successful 1'] = {
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch stops retrying to add the label after 3 attempts, even if it is never successful 2'] = {
"event": "APPROVE"
}

exports['auto-approve main auto-approve function config exists on main branch submits a failing check if config exists but is not valid 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'failure',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'auto-approve.yml config check failed',
'text': 'See the following errors in your auto-approve.yml config:\n[{"wrongProperty":"wrongProperty","message":"message"}]\n'
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "failure",
"output": {
"title": "Auto-approve.yml check",
"summary": "auto-approve.yml config check failed",
"text": "See the following errors in your auto-approve.yml config:\n[{\"wrongProperty\":\"wrongProperty\",\"message\":\"message\"}]\n"
}
}

exports['auto-approve main auto-approve function config exists on main branch logs to the console if config is valid but PR is not 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch will not check config on master if the config is modified on PR 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'failure',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'auto-approve.yml config check failed',
'text': 'See the following errors in your auto-approve.yml config:\n\n'
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "failure",
"output": {
"title": "Auto-approve.yml check",
"summary": "auto-approve.yml config check failed",
"text": "See the following errors in your auto-approve.yml config:\n\n"
}
}

exports['auto-approve main auto-approve function config exists on main branch uses the correct function to check the PR if the config is V2 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch uses the correct function to check the PR if the config is V2 2'] = {
'event': 'APPROVE'
"event": "APPROVE"
}

exports['auto-approve main auto-approve function config exists on main branch uses the correct function to check the PR if the config is V1 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config exists on main branch uses the correct function to check the PR if the config is V1 2'] = {
'event': 'APPROVE'
"event": "APPROVE"
}

exports['auto-approve main auto-approve function config does not exist on main branch attempts to create a passing status check if PR contains correct config 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config does not exist on main branch attempts to create a failing status check if PR contains wrong config, and error messages check out 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'failure',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'auto-approve.yml config check failed',
'text': 'See the following errors in your auto-approve.yml config:\n[{"wrongProperty":"wrongProperty","message":"message"}]\n'
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "failure",
"output": {
"title": "Auto-approve.yml check",
"summary": "auto-approve.yml config check failed",
"text": "See the following errors in your auto-approve.yml config:\n[{\"wrongProperty\":\"wrongProperty\",\"message\":\"message\"}]\n"
}
}

exports['auto-approve main auto-approve function config does not exist on main branch passes PR if auto-approve is on main, not PR 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve main auto-approve function config does not exist on main branch passes PR if auto-approve is on main, not PR 2'] = {
'event': 'APPROVE'
"event": "APPROVE"
}

exports['auto-approve gets secrets and authenticates separately for approval creates a separate octokit instance and authenticates with secret in secret manager 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
"head_sha": "c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a",
"name": "Auto-approve.yml check",
"conclusion": "success",
"output": {
"title": "Auto-approve.yml check",
"summary": "Successful auto-approve.yml config check",
"text": ""
}
}

exports['auto-approve gets secrets and authenticates separately for approval creates a separate octokit instance and authenticates with secret in secret manager 2'] = {
'event': 'APPROVE'
}

exports['auto-approve main auto-approve function config exists on main branch retries if etag is not current 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
}
}

exports['auto-approve main auto-approve function config exists on main branch retries if etag is not current 2'] = {
'event': 'APPROVE'
}

exports['auto-approve main auto-approve function config exists on main branch stops retrying to add the label after 3 attempts, even if it is never successful 1'] = {
'head_sha': 'c5b0c82f5d58dd4a87e4e3e5f73cd752e552931a',
'name': 'Auto-approve.yml check',
'conclusion': 'success',
'output': {
'title': 'Auto-approve.yml check',
'summary': 'Successful auto-approve.yml config check',
'text': ''
}
}

exports['auto-approve main auto-approve function config exists on main branch stops retrying to add the label after 3 attempts, even if it is never successful 2'] = {
'event': 'APPROVE'
"event": "APPROVE"
}
2 changes: 1 addition & 1 deletion packages/auto-approve/__snapshots__/check-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports['check for config whether YAML file has valid schema should fail if ther
`

exports['check for config whether YAML file has valid schema V2 should fail if YAML has any other properties than the ones specified 1'] = `
[{"wrongProperty":{"allowedValues":["UpdateDiscoveryArtifacts","RegenerateReadme","DiscoveryDocUpdate","PythonDependency","PythonSampleDependency","NodeDependency","NodeRelease","JavaApiaryCodegen","JavaDependency","OwlBotTemplateChanges","OwlBotAPIChanges","PHPApiaryCodegen","PythonSampleAppDependency","DockerDependency","GoDependency","GoApiaryCodegen"]},"message":"must be equal to one of the allowed values"}]
[{"wrongProperty":{"allowedValues":["UpdateDiscoveryArtifacts","RegenerateReadme","DiscoveryDocUpdate","PythonDependency","PythonSampleDependency","NodeDependency","NodeRelease","JavaApiaryCodegen","JavaDependency","OwlBotTemplateChanges","OwlBotAPIChanges","PHPApiaryCodegen","PythonSampleAppDependency","JavaSampleAppDependency","DockerDependency","GoDependency","GoApiaryCodegen"]},"message":"must be equal to one of the allowed values"}]
`

exports['check for config whether YAML file has valid schema V2 should fail if the property is wrong 1'] = `
Expand Down
5 changes: 5 additions & 0 deletions packages/auto-approve/src/check-pr-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {RegenerateReadme} from './process-checks/regenerate-readme';
import {DiscoveryDocUpdate} from './process-checks/discovery-doc-update';
import {PythonDependency} from './process-checks/python/dependency';
import {PythonSampleAppDependency} from './process-checks/sample-application-repos/python-dependency';
import {JavaSampleAppDependency} from './process-checks/sample-application-repos/java-dependency';
import {GoDependency} from './process-checks/sample-application-repos/go-dependency';
import {DockerDependency} from './process-checks/sample-application-repos/docker-dependency';
import {NodeDependency} from './process-checks/node/dependency';
Expand Down Expand Up @@ -102,6 +103,10 @@ const typeMap = [
configValue: 'DockerDependency',
configType: DockerDependency,
},
{
configValue: 'JavaSampleAppDependency',
configType: JavaSampleAppDependency,
},
];

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/auto-approve/src/process-checks/java/dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import {BaseLanguageRule} from '../base';
- Each file path must match one of these regexps:
- /pom.xml$/
- All files must:
- Match this regexp: /pom.xml$/
- Match this regexp: /pom.xml$/ or /build.gradle$/
- Increase the non-major package version of a dependency
- Only change one dependency
- Change the dependency that was there previously, and that is on the title of the PR, and is a Google dependency
- Change the dependency that was there previously, and that is on the title of the PR, and is a Google or grpc dependency
*/
export class JavaDependency extends BaseLanguageRule {
classRule = {
Expand Down
Loading