Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmullicani committed Jun 7, 2023
2 parents 8028f96 + afcce36 commit 97a5b47
Show file tree
Hide file tree
Showing 16 changed files with 178 additions and 210 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.3.dev
current_version = 0.0.5.dev
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+))?
Expand Down
38 changes: 26 additions & 12 deletions .ci/scripts/validate_commit_message.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,44 @@
import os
import re
import subprocess
import sys
from pathlib import Path

import toml
from github import Github

KEYWORDS = ["fixes", "closes"]
BLOCKING_REGEX = [
"DRAFT",
"WIP",
"NOMERGE",
r"DO\s*NOT\s*MERGE",
"EXPERIMENT",
]
NO_ISSUE = "[noissue]"
CHANGELOG_EXTS = [".feature", ".bugfix", ".doc", ".removal", ".misc", ".deprecation"]
CHANGELOG_EXTS = [
f".{item['directory']}" for item in toml.load("pyproject.toml")["tool"]["towncrier"]["type"]
]

sha = sys.argv[1]
project = "pulp-cli-deb"
message = subprocess.check_output(["git", "log", "--format=%B", "-n 1", sha]).decode("utf-8")

g = Github()
if any((re.match(pattern, message) for pattern in BLOCKING_REGEX)):
sys.exit("This PR is not ready for consumption.")

g = Github(os.environ.get("GITHUB_TOKEN"))
repo = g.get_repo("pulp/pulp-cli-deb")


def __check_status(issue):
def check_status(issue):
gi = repo.get_issue(int(issue))
if gi.pull_request:
sys.exit(f"Error: issue #{issue} is a pull request.")
if gi.closed_at:
sys.exit(f"Error: issue #{issue} is closed.")


def __check_changelog(issue):
def check_changelog(issue):
matches = list(Path("CHANGES").rglob(f"{issue}.*"))

if len(matches) < 1:
Expand All @@ -38,15 +51,16 @@ def __check_changelog(issue):
print("Checking commit message for {sha}.".format(sha=sha[0:7]))

# validate the issue attached to the commit
regex = r"(?:{keywords})[\s:]+#(\d+)".format(keywords=("|").join(KEYWORDS))
pattern = re.compile(regex, re.IGNORECASE)

issues = pattern.findall(message)
issue_regex = r"(?:{keywords})[\s:]+#(\d+)".format(keywords=("|").join(KEYWORDS))
issues = re.findall(issue_regex, message, re.IGNORECASE)
cherry_pick_regex = r"^\s*\(cherry picked from commit [0-9a-f]*\)\s*$"
cherry_pick = re.search(cherry_pick_regex, message, re.MULTILINE)

if issues:
for issue in pattern.findall(message):
__check_status(issue)
__check_changelog(issue)
for issue in issues:
if not cherry_pick:
check_status(issue)
check_changelog(issue)
else:
if NO_ISSUE in message:
print("Commit {sha} has no issues but is tagged {tag}.".format(sha=sha[0:7], tag=NO_ISSUE))
Expand Down
97 changes: 0 additions & 97 deletions .github/workflows/kanban.yml

This file was deleted.

8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ jobs:
- python: "3.6"
image_tag: "3.21"
- python: "3.7"
pulp_cli: "0.17.0"
image_tag: "3.20"
- python: "3.8"
pulp_cli: "0.16.0"
image_tag: "3.19"
- python: "3.9"
image_tag: "3.18"
- python: "3.10"
pulp_cli: "0.15.0"
image_tag: "3.17"
image_tag: "3.22"
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -70,7 +72,9 @@ jobs:
- name: Install Test Dependencies
run: pip install -r test_requirements.txt
- name: Install pulp-cli from source
run: pip install git+https://github.com/pulp/pulp-cli@main
run: |
pip install "git+https://github.com/pulp/pulp-cli@main#egg=pulp-glue&subdirectory=pulp-glue"
pip install "git+https://github.com/pulp/pulp-cli@main#egg=pulp-cli"
if: ${{ ! matrix.pulp_cli }}
- name: Install specific pulp-cli version
run: pip install pulp_cli==${{ matrix.pulp_cli }}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ jobs:
- python: "3.6"
image_tag: "3.21"
- python: "3.7"
pulp_cli: "0.17.0"
image_tag: "3.20"
- python: "3.8"
pulp_cli: "0.16.0"
image_tag: "3.19"
- python: "3.9"
image_tag: "3.18"
- python: "3.10"
pulp_cli: "0.15.0"
image_tag: "3.17"
image_tag: "3.22"
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -42,7 +44,9 @@ jobs:
- name: Install Test Dependencies
run: pip install -r test_requirements.txt
- name: Install pulp-cli from source
run: pip install git+https://github.com/pulp/pulp-cli@main
run: |
pip install "git+https://github.com/pulp/pulp-cli@main#egg=pulp-glue&subdirectory=pulp-glue"
pip install "git+https://github.com/pulp/pulp-cli@main#egg=pulp-cli"
if: ${{ ! matrix.pulp_cli }}
- name: Install specific pulp-cli version
run: pip install pulp_cli==${{ matrix.pulp_cli }}
Expand Down
52 changes: 52 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,58 @@

[//]: # (towncrier release notes start)

## 0.0.4 (2023-03-09)
=====================


### Misc

- Adopted PREFIX_ID pattern introduced in pulp-cli 0.14.
[#27](https://github.com/pulp/pulp-cli-deb/issues/27)


---


## 0.0.3 (2023-01-03)
=====================


### Features

- Added support for the new --optimize/--no-optimize sync option.
[#31](https://github.com/pulp/pulp-cli-deb/issues/31)
- Use flags for ``--simple`` and ``--structured`` on publication create instead of having users
specify a value of ``True``.
[#36](https://github.com/pulp/pulp-cli-deb/issues/36)


### Improved Documentation

- Added a help text for the --mirror/--no-mirror sync option.
[#30](https://github.com/pulp/pulp-cli-deb/issues/30)


### Deprecations and Removals

- Bumped pulp-cli dependency to >=0.13.0.
[#10](https://github.com/pulp/pulp-cli-deb/issues/10)


### Translations

- Added rudimentary German translations files.
[#10](https://github.com/pulp/pulp-cli-deb/issues/10)


### Misc

- [#10](https://github.com/pulp/pulp-cli-deb/issues/10)


---


## 0.0.2 (2022-01-03)

### Features
Expand Down
1 change: 0 additions & 1 deletion CHANGES/10.misc

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/10.removal

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/10.translation

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/30.doc

This file was deleted.

1 change: 0 additions & 1 deletion CHANGES/31.feature

This file was deleted.

2 changes: 0 additions & 2 deletions CHANGES/36.feature

This file was deleted.

0 comments on commit 97a5b47

Please sign in to comment.