Skip to content
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
28 changes: 24 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
# --------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to You under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# --------------------------------------------------------------------

name: "\U0001F41B Bug Report"
description: Problems and issues with code in gp-common-go-libs for CloudberryDB.
description: Problems and issues with code in cloudberry-go-libs for Apache Cloudberry.
title: "[Bug] "
labels: ["type: Bug"]
body:
- type: markdown
attributes:
value: "Thank you for reporting the problem! We really appreciate your efforts to improve Cloudberry Database. Before reporting it, please (ideally) test on the latest release or main to see if the issue is fixed."
value: "Thank you for reporting the problem! We really appreciate your efforts to improve Apache Cloudberry. Before reporting it, please (ideally) test on the latest release or main to see if the issue is fixed."
- type: textarea
attributes:
label: Cloudberry Database version
label: Apache Cloudberry version
description: What version are you using?
- type: textarea
attributes:
Expand Down Expand Up @@ -56,7 +76,7 @@ body:
options:
- label: >
I agree to follow this project's
[Code of Conduct](https://cloudberrydb.org/community/coc).
[Code of Conduct](https://github.com/apache/cloudberry/blob/main/CODE_OF_CONDUCT.md).
required: true
- type: markdown
attributes:
Expand Down
37 changes: 30 additions & 7 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
blank_issues_enabled: false
# --------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to You under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# --------------------------------------------------------------------

blank_issues_enabled: true
contact_links:
- name: 🙏🏻 Q&A
url: https://github.com/orgs/cloudberrydb/discussions/categories/q-a
about: Ask for help when running/developing Cloudberry Database.
url: https://github.com/apache/cloudberry/discussions/categories/q-a
about: Ask for help when running/developing Apache Cloudberry.
- name: 💡️ New Ideas / Feature Requests
url: https://github.com/orgs/cloudberrydb/discussions/categories/ideas-feature-requests
url: https://github.com/apache/cloudberry/discussions/categories/ideas-feature-requests
about: Share ideas for new features.
- name: 🎙️ Submit Your Proposal
url: https://github.com/orgs/cloudberrydb/discussions/categories/proposal
about: As a developer, proposing any major change or enhancement to Cloudberry Database.
url: https://github.com/apache/cloudberry/discussions/categories/proposal
about: As a developer, proposing any major change or enhancement to Apache Cloudberry.
- name: 💬️ Join Slack for Real-time Chat
url: https://communityinviter.com/apps/cloudberrydb/welcome
url: https://inviter.co/apache-cloudberry
about: Real-time chat including QA, Dev, Events and more.
- name: 🪲 Issues for Website, Docs
url: https://github.com/apache/cloudberry-site/issues
about: Hey, we have one dedicated repo for the website and docs.
13 changes: 7 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<!--Thank you for contributing! -->

<!--In case of an existing issue or discussions, please reference it-->
fix #ISSUE_Number
closes: #ISSUE_Number
<!--Remove this section if no corresponding issue.-->

---
Expand All @@ -13,8 +14,8 @@ fix #ISSUE_Number

Here are some reminders before you submit your pull request:

* Make sure that your Pull Request has a clear title and commit message. You can take the [Git commit template](https://github.com/cloudberrydb/cloudberrydb/blob/main/.gitmessage) as a reference.
* Sign the Contributor License Agreement as prompted for your first-time contribution (*One-time setup*).
* Learn the [code contribution](https://cloudberrydb.org/contribute/code) and [doc contribution](https://cloudberrydb.org/contribute/doc) guides for better collaboration.
* List your communications in the [GitHub Issues](https://github.com/cloudberrydb/cloudberrydb-site/issues) or [Discussions](https://github.com/orgs/cloudberrydb/discussions) (if has or needed).
* Feel free to ask for the cloudberrydb team to help review and approve.
* Make sure that your Pull Request has a clear title and commit message. You can take the [Git commit template](https://github.com/apache/cloudberry/blob/main/.gitmessage) as a reference.
* Learn the [code contribution](https://cloudberry.apache.org/contribute/code) and [doc contribution](https://cloudberry.apache.org/contribute/doc) guides for better collaboration.
* Make sure that CICD workflow is successful.
* List your communications in the [GitHub Issues](https://github.com/apache/cloudberry-go-libs/issues) or [Discussions](https://github.com/apache/cloudberry/discussions) (if has or needed).
* Feel free to ask for the [cloudberry committers](https://github.com/orgs/apache/teams/cloudberry-committers) or other people to help review and approve.
274 changes: 274 additions & 0 deletions .github/workflows/apache-rat-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
# --------------------------------------------------------------------
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed
# with this work for additional information regarding copyright
# ownership. The ASF licenses this file to You under the Apache
# License, Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# --------------------------------------------------------------------
# Apache Cloudberry Go-libs (Incubating) Compliance Workflow
#
# Comprehensive compliance checks for Apache Cloudberry Go-libs:
# 1. Apache RAT license header validation
# 2. Copyright year verification (NOTICE)
# 3. Binary file presence detection
#
# Based on Apache Rat tool, run locally with:
# `mvn clean verify -Drat.consoleOutput=true`
# --------------------------------------------------------------------

name: Apache Rat License Check

on:
push:
branches: [main, REL_2_STABLE]
pull_request:
branches: [main, REL_2_STABLE]
types: [opened, synchronize, reopened, edited]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rat-check:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Java and Maven
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: maven

- name: Run Apache Rat check
run: |
echo "Running Apache Rat license check..."
mvn clean verify -Drat.consoleOutput=true

# Check for build failure
if grep -q "\[INFO\] BUILD FAILURE" target/rat.txt; then
echo "::error::Apache Rat check failed - build failure detected"
echo "RAT_CHECK=fail" >> $GITHUB_ENV
else
echo "RAT_CHECK=pass" >> $GITHUB_ENV
echo "Apache Rat check passed successfully"
fi

- name: Check copyright years are up-to-date
run: |
echo "Checking copyright years..."
current_year=$(date -u +"%Y")
echo "CURRENT_YEAR=$current_year" >> $GITHUB_ENV

# Initialize to pass, will be updated if checks fail
echo "NOTICE_CHECK=pass" >> $GITHUB_ENV

# Check NOTICE file
echo "Checking NOTICE file..."
if ! grep -q "Copyright 2024-$current_year The Apache Software Foundation" NOTICE; then
echo "::error::NOTICE file does not contain the current year ($current_year)"
echo "NOTICE_CHECK=fail" >> $GITHUB_ENV
else
echo "PASS: NOTICE file contains the current year ($current_year)"
fi

# Continue execution even if checks fail
if [ "$NOTICE_CHECK" = "pass" ]; then
echo "All copyright year checks passed"
else
echo "Copyright year checks completed with errors"
fi

- name: Check for binary files
run: |
echo "Checking for binary files..."
echo "Checking extensions: class, jar, tar, tgz, zip, exe, dll, so, gz, bz2"
echo "----------------------------------------------------------------------"

# Check for specific binary file extensions
binary_extensions="class jar tar tgz zip exe dll so gz bz2"
echo "BINARY_EXTENSIONS=${binary_extensions}" >> $GITHUB_ENV
binary_results=""
binaryfiles_found=false

for extension in ${binary_extensions}; do
printf "Checking *.%-4s files..." "${extension}"
found=$(find . -name "*.${extension}" -type f || true)

if [ -n "$found" ]; then
echo "FOUND"
echo "::error::${extension} files should not exist"
echo "For ASF compatibility: the source tree should not contain"
echo "binary files as users have a hard time verifying their contents."
echo "Found files:"
echo "$found" | sed 's/^/ /'
echo "${extension}:${found}" >> binary_results.txt
binaryfiles_found=true
else
echo "NONE"
echo "${extension}:none" >> binary_results.txt
fi
done

echo "----------------------------------------------------------------------"
if [ "$binaryfiles_found" = true ]; then
echo "ERROR: Binary files were found in the source tree"
echo "BINARY_CHECK=fail" >> $GITHUB_ENV
else
echo "PASS: No binary files found"
echo "BINARY_CHECK=pass" >> $GITHUB_ENV
fi

- name: Upload Rat check results
if: always()
uses: actions/upload-artifact@v4
with:
name: rat-check-results
path: target/rat.txt
retention-days: 7

- name: Generate Job Summary
if: always()
run: |
{
echo "## Apache Cloudberry Go-libs Compliance Audit Results"
echo "- Run Time: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
echo ""

# Copyright Year Check Summary
echo "### Copyright Year Checks"
echo "**NOTICE file:**"
if [ "$NOTICE_CHECK" = "pass" ]; then
echo "PASS: Contains current year ($CURRENT_YEAR)"
else
echo "ERROR: Does not contain current year ($CURRENT_YEAR)"
fi
echo ""

# Binary Files Check Summary
echo "### Binary Files Check"
echo "Checked extensions: \`${BINARY_EXTENSIONS}\`"
echo ""
echo "Results:"
echo "\`\`\`"
if [ -f binary_results.txt ]; then
while IFS=: read -r ext files; do
if [ "$files" = "none" ]; then
echo "PASS: No .${ext} files found"
else
echo "ERROR: Found .${ext} files:"
echo "$files" | sed 's/^/ /'
fi
done < binary_results.txt
fi
echo "\`\`\`"
echo ""

# Rat check summary
if [[ -f target/rat.txt ]]; then
# First extract and display summary statistics (only once)
if grep -q "Rat check: Summary over all files" target/rat.txt; then
echo "### License Header Check"
summary_line=$(grep "Rat check: Summary over all files" target/rat.txt)
echo "\`\`\`"
echo "$summary_line"
echo "\`\`\`"
echo ""
fi

# Then determine the result status
if [ "$RAT_CHECK" = "fail" ]; then
echo "#### Check Failed - License Compliance Issues Detected"
echo ""

# Extract and display files with unapproved licenses
if grep -q "Files with unapproved licenses:" target/rat.txt; then
echo "##### Files with Unapproved Licenses"
echo "\`\`\`"
# Get the line with "Files with unapproved licenses:" and all following lines until the dashed line
sed -n '/Files with unapproved licenses:/,/\[INFO\] ------------------------------------------------------------------------/p' target/rat.txt | \
grep -v "\[INFO\] ------------------------------------------------------------------------" | \
grep -v "^$" | \
head -20
echo "\`\`\`"
echo ""
fi

echo "**How to fix:**"
echo ""
echo "**For new original files you created:**"
echo "- Add the standard Apache License header to each file"
echo ""
echo "**For third-party files with different licenses:**"
echo "- Add the file to exclusion list in \`pom.xml\` under the rat-maven-plugin configuration"
echo "- Ensure the license is compatible with Apache License 2.0"
echo "- Avoid introducing components with incompatible licenses"
echo ""
echo "**Need help?**"
echo "- Run \`mvn clean verify -Drat.consoleOutput=true\` locally for the full report"
echo "- Email dev@cloudberry.apache.org if you have questions about license compatibility"

elif [ "$RAT_CHECK" = "pass" ]; then
echo "#### Check Passed - All Files Comply with Apache License Requirements"
fi
fi
} >> "$GITHUB_STEP_SUMMARY"

- name: Report Status
if: always()
shell: bash {0}
run: |
# Check overall status of all checks
overall_status=0

# Check Apache RAT status
if [ "$RAT_CHECK" = "fail" ]; then
echo "ERROR: Apache Rat check failed"
overall_status=1
elif [ "$RAT_CHECK" = "pass" ]; then
echo "Apache Rat check passed"
fi

# Check copyright year status
if [ -n "$NOTICE_CHECK" ] && [ "$NOTICE_CHECK" = "fail" ]; then
echo "ERROR: NOTICE file copyright year check failed"
overall_status=1
fi

# Check binary files status (if this variable exists)
if [ -n "$BINARY_CHECK" ] && [ "$BINARY_CHECK" = "fail" ]; then
echo "ERROR: Binary files check failed"
overall_status=1
fi

# Exit with appropriate status
if [ $overall_status -eq 0 ]; then
echo "SUCCESS: All checks passed"
exit 0
else
echo "FAILURE: One or more checks failed"
exit 1
fi
Loading
Loading