Skip to content

Commit

Permalink
Merge branch 'master' into issue/2711
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmatthiaskern committed Jul 5, 2022
2 parents d1306e2 + 8533a1e commit 0f86ac3
Show file tree
Hide file tree
Showing 339 changed files with 13,868 additions and 3,131 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ assignees: ''

**Operating System Type & Version**:

**Infrastructure Type/Provider**: <AWC, GCS, Azure, VM, etc>


## Description

Expand Down
3 changes: 0 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ updates:
open-pull-requests-limit: 10
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
78 changes: 26 additions & 52 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,38 @@
<!--- This environment context section helps us quickly review your PR.
Please take a minute to fill-out this information. -->
## Environment
## Impact

**Liquibase Version**:

**Liquibase Integration & Version**: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>

**Liquibase Extension(s) & Version**:

**Database Vendor & Version**:

**Operating System Type & Version**:

## Pull Request Type

<!--- What types of changes does your code introduce?
Put an `x` in all the boxes that apply:
If this PR fixes an existing GH issue, edit the next line to add "closes #XXXX" to auto-link.
If this PR fixes an existing CORE Jira issue, note that as well, although there will be no auto-linking. -->
- [ ] Bug fix (non-breaking change which fixes an issue.)
- [ ] Enhancement/New feature (non-breaking change which adds functionality)
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes expected existing functionality)
- [ ] Enhancement/New feature (adds functionality without impacting existing logic)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Description

A clear and concise description of the issue being addressed. Additional guidance [here](https://liquibase.jira.com/wiki/spaces/LB/pages/1274904896/How+to+Contribute+Code+to+Liquibase+Core).
- Describe the actual problematic behavior.
A clear and concise description of the change being made.

- Introduce what was/will be done in the title
- Titles show in release notes and search results, so make them useful
- Use verbs at the beginning of the title, such as "fix", "implement", "improve", "update", and "add"
- Be specific about what was fixed or changed
- Good Example: `Fix the --should-snapshot-data CLI parameter to be preserved when the --data-output-directory property is not specified in the command.`
- Bad Example: `Fixed --should-snapshot-data`
- If there is an existing issue this addresses, include "Fixes #XXXX" to auto-link the issue to this PR
- If there is NOT an existing issue, consider creating one.
- In general, issues describe wanted change from an end-user perspective and PRs describe the technical change.
- If this change is very small and not worth splitting off an issue, include `Steps To Reproduce`, `Expected Behavior`, and `Actual Behavior` sections in this PR as you would have in the issue.
- Describe what users need and how the fix will affect them
- Describe how the code change addresses the problem
- Ensure private information is redacted.

## Steps To Reproduce

List the steps to reproduce the behavior.
- Please be precise and ensure private information is redacted
- Include things like
- Files used - sql scripts, changelog file(s), property file(s), config files, POM Files
- Exact commands used - CLI, maven, gradle, spring boot, servlet, etc.
## Things to be aware of

## Actual Behavior
A clear and concise description of what happens in the software **before** this pull request.
- Include console output if relevant
- Include log files if available.
- Describe the technical choices you made
- Describe impacts on the codebase

## Expected/Desired Behavior
A clear and concise description of what happens in the software **after** this pull request.
## Things to worry about

## Screenshots (if appropriate)
If applicable, add screenshots to help explain your problem.
- List any questions or concerns you have with the change
- List unknowns you have

## Additional Context
Add any other context about the problem here.

## Fast Track PR Acceptance Checklist:
<!--- Completing these speeds up the acceptance of your pull request -->
<!--- Put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, just ask us in a comment. We're here to help! -->
- [ ] Build is successful and all new and existing tests pass
- [ ] Added [Unit Test(s)](https://liquibase.jira.com/wiki/spaces/LB/pages/1274937609/How+to+Write+Liquibase+Core+Unit+Tests)
- [ ] Added [Integration Test(s)](https://liquibase.jira.com/wiki/spaces/LB/pages/1276608569/How+to+Write+Liquibase+Core+Integration+Tests)
- [ ] Added [Test Harness Test(s)](https://github.com/liquibase/liquibase-test-harness/pulls)
- [ ] Documentation Updated

## Need Help?
Come chat with us in the [Liquibase Forum](https://forum.liquibase.org/).
Add any other context about the problem here.
139 changes: 87 additions & 52 deletions .github/util/workflow-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ module.exports = ({github, context}) => {
}
},

getCurrentBranchLabel: function () {
if (context.payload.pull_request) {
return this.cleanBranchRef(context.payload.pull_request.head.label);
} else {
return this.cleanBranchRef(context.payload.ref);
}
},

getCurrentSha: function () {
if (context.payload.pull_request) {
return this.cleanBranchRef(context.payload.pull_request.head.sha);
Expand Down Expand Up @@ -102,69 +110,96 @@ module.exports = ({github, context}) => {
returnData.pullRequestState = pulls.data[0].state;
}

try { //add build info
let runs = await github.rest.actions.listWorkflowRuns({
"owner": owner,
"repo": repo,
"workflow_id": "build.yml",
"branch": branchName,
"per_page": 20,
"page": 1,
});

if (runs.data.workflow_runs.length !== 0) {
for (let run of runs.data.workflow_runs) {
if (run.event === 'pull_request_target') {
if (!returnData.pullRequestId) {
console.log("Skipping pull_request_target from non-pull-request build " + run.html_url);
continue;
let pageNumber = 1;
const maxPagesToCheck = 10;
let matchingBuildFound = false;
while(!matchingBuildFound) {
try { //add build info
let workflowId = "build.yml";
if (repo === "liquibase-test-harness") {
workflowId = "main.yml";
} else if (repo === "liquibase-pro-tests") {
workflowId = "test.yml";
}


console.log("Reading workflow run results from page", pageNumber)
let runs = await github.rest.actions.listWorkflowRuns({
"owner": owner,
"repo": repo,
"workflow_id": workflowId,
"per_page": 100,
"page": pageNumber,
});

if (runs.data.workflow_runs.length !== 0) {
for (let run of runs.data.workflow_runs) {
if (run.event === 'pull_request_target') {
if (!returnData.pullRequestId) {
console.log("Skipping pull_request_target from non-pull-request build " + run.html_url);
continue;
}
if (run.head_repository && run.head_repository.fork) {
console.log("Skipping pull_request_target from fork " + run.head_repository.full_name);
continue;
}
}
if (run.head_repository && run.head_repository.fork) {
console.log("Skipping pull_request_target from fork " + run.head_repository.full_name);
if (run.head_branch != branchName) {
console.log("Skipping run from branch: " + run.head_branch);
continue;
}
}
console.log(`Found build for branch ${branchName}`);

if (!returnData.workflowId) {
returnData.workflowId = run.id;
}
console.log(`Found build for branch ${branchName}`);

if (!returnData.runNumber) {
returnData.runNumber = run.run_number;
returnData.runAttempt = run.run_attempt;
returnData.runStatus = run.status;
returnData.runConclusion = run.conclusion;
returnData.runHtmlUrl = run.html_url;
returnData.runRerunUrl = run.rerun_url;
}
if (!returnData.workflowId) {
returnData.workflowId = run.id;
}

if (!returnData.runNumber) {
returnData.runNumber = run.run_number;
returnData.runAttempt = run.run_attempt;
returnData.runStatus = run.status;
returnData.runConclusion = run.conclusion;
returnData.runHtmlUrl = run.html_url;
returnData.runRerunUrl = run.rerun_url;
}

if (run.status === "completed" && run.conclusion === "success") {
console.log(`Found successful build for branch ${branchName}`);
returnData.lastSuccessfulRunNumber = run.run_number;
returnData.lastSuccessfulRunAttempt = run.run_attempt;
returnData.lastSuccessfulRunStatus = run.status;
returnData.lastSuccessfulRunConclusion = run.conclusion;
returnData.lastSuccessfulRunHtmlUrl = run.html_url;
returnData.lastSuccessfulRunRerunUrl = run.rerun_url;

break;
} else {
console.log(`Found build ${run.run_number} was status: ${run.status} conclusion:${run.conclusion}`);
if (run.status === "completed" && run.conclusion === "success") {
console.log(`Found successful build for branch ${branchName}`);
returnData.lastSuccessfulRunNumber = run.run_number;
returnData.lastSuccessfulRunAttempt = run.run_attempt;
returnData.lastSuccessfulRunStatus = run.status;
returnData.lastSuccessfulRunConclusion = run.conclusion;
returnData.lastSuccessfulRunHtmlUrl = run.html_url;
returnData.lastSuccessfulRunRerunUrl = run.rerun_url;
returnData.lastSuccessfulWorkflowId = run.id;

matchingBuildFound = true;
break;
} else {
console.log(`Found build ${run.run_number} was status: ${run.status} conclusion:${run.conclusion}`);
}
}
}
}

if (!returnData.workflowId) {
console.log(`No build for branch ${branchName}`);
}
if (!returnData.workflowId) {
console.log(`No build for branch ${branchName}`);
}

} catch (error) {
if (error.status === 404) {
console.log(`Cannot get build info for ${branchName}`);
} else {
throw error;
} catch (error) {
console.log(`Error getting build info for ${branchName}`)
console.log(error);
if (error.status === 404) {
console.log(`Cannot get build info for ${branchName}`);
} else {
throw error;
}
}
if (pageNumber >= maxPagesToCheck) {
console.log("Hit page limit maximum of", maxPagesToCheck);
matchingBuildFound = true;
}
pageNumber++;
}

console.log("Matching branch information: ");
Expand Down

0 comments on commit 0f86ac3

Please sign in to comment.