Skip to content

Commit

Permalink
Clean code and ensure same behavior for pre-commit and manual run of …
Browse files Browse the repository at this point in the history
…the python code
  • Loading branch information
MichaelKora committed Jan 16, 2024
1 parent 69672db commit 4881fed
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 89 deletions.
10 changes: 5 additions & 5 deletions .github/generate-doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def format_markdown_file(filename):
file.write(formatted_content)
replace_string_in_markdown(filename, "<p>", "")
replace_string_in_markdown(filename, "</p>", "")
# replace_string_in_markdown(filename, "<li>", "")
# replace_string_in_markdown(filename, "</li>", "")
replace_string_in_markdown(filename, "<em>", "_")
replace_string_in_markdown(filename, "</em>", "_")


def contains_subsection(file_path, target_subsection_title):
Expand Down Expand Up @@ -213,7 +213,7 @@ def run():
"## Secrets"]

# go through actions
os.makedirs("tmps", exist_ok=True)
os.makedirs("tmps/", exist_ok=True)
tmp_action = "tmps/actions"
os.makedirs(tmp_action, exist_ok=True)
changes = []
Expand Down Expand Up @@ -293,9 +293,9 @@ def run():
count += 1
if count == 0:
print_colored("√ Documentation up to date", Colors.GREEN)
safe_remove_directory("tmps")
safe_remove_directory("tmps/")
else:
safe_remove_directory("tmps")
safe_remove_directory("tmps/")
raise DocGenerationError(count)


Expand Down
20 changes: 10 additions & 10 deletions docs/actions/changelog-generate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ files. A simple configuration may look like this:
<code>json
{
"categories": [{ "title": "### Merged pull requests:" }],
"ignore<em>labels": ["ignore"],
"sort": { "order": "ASC", "on</em>property": "mergedAt" },
"template": "# <a href="https://github.com/#{{OWNER}}/#{{REPO}}/releases/tag/#{{TO_TAG}}">#{{TO<em>TAG}}</a> - Release Date: #{{TO</em>TAG<em>DATE}}\n\n#{{CHANGELOG}}",
"pr</em>template": "- #{{TITLE}} <a href="#{{URL}}">##{{NUMBER}}</a> (<a href="https://github.com/#{{AUTHOR}}">@#{{AUTHOR}}</a>)\n",
"ignore_labels": ["ignore"],
"sort": { "order": "ASC", "on_property": "mergedAt" },
"template": "# <a href="https://github.com/#{{OWNER}}/#{{REPO}}/releases/tag/#{{TO_TAG}}">#{{TO_TAG}}</a> - Release Date: #{{TO_TAG_DATE}}\n\n#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}} <a href="#{{URL}}">##{{NUMBER}}</a> (<a href="https://github.com/#{{AUTHOR}}">@#{{AUTHOR}}</a>)\n",
"empty_template": "- no changes!"
}
</code>

Make sure to update the link
<code>https://github.com/&lt;myorganization&gt;/&lt;myrepository&gt;/releases/tag/${{TO<em>TAG}}</code>
accordingly and make sure to include <code>- Release Date: ${{TO</em>TAG_DATE}}</code>
<code>https://github.com/&lt;myorganization&gt;/&lt;myrepository&gt;/releases/tag/${{TO_TAG}}</code>
accordingly and make sure to include <code>- Release Date: ${{TO_TAG_DATE}}</code>
because the action looks for this pattern to make the date format easily readable.

Additional configuration options can be explored
Expand All @@ -67,18 +67,18 @@ steps:
persist-credentials: false
fetch-depth: 0
- name: Create changelog
id: build<em>changelog
id: build_changelog
uses: bakdata/ci-templates/actions/changelog-generate@main
with:
github-token: ${{ secrets.GH</em>TOKEN }}
github-token: ${{ secrets.GH_TOKEN }}
new-tag: "1.0.0"
changelog-file: "CHANGELOG.md"
fetch-reviewers: "true"
fetch-release-information: "true"
- name: Use output
run: |
echo "${{ steps.build<em>changelog.outputs.single-changelog }}" &gt; tag</em>changelog.md
echo "${{ steps.build<em>changelog.outputs.merged-changelog }}" &gt; global</em>changelog.md
echo "${{ steps.build_changelog.outputs.single-changelog }}" &gt; tag_changelog.md
echo "${{ steps.build_changelog.outputs.merged-changelog }}" &gt; global_changelog.md
shell: bash
</code>

Expand Down
2 changes: 1 addition & 1 deletion docs/actions/docker-publish/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>Description docker-publish composite action</h1>

This action downloads an <code>image.tar</code> file from an artifact and publishes it into a Docker registry. When this action is used on a tag branch, the image is tagged with <code>latest</code> and the tag version of the branch (e.g. <code>1.2.3</code>). For all other branches, the tag <code>pipeline-${{ github.run<em>id }}-git-${GITHUB</em>SHA::8}</code> is used as an image tag.
This action downloads an <code>image.tar</code> file from an artifact and publishes it into a Docker registry. When this action is used on a tag branch, the image is tagged with <code>latest</code> and the tag version of the branch (e.g. <code>1.2.3</code>). For all other branches, the tag <code>pipeline-${{ github.run_id }}-git-${GITHUB_SHA::8}</code> is used as an image tag.

<h2>Prerequisites</h2>

Expand Down
2 changes: 1 addition & 1 deletion docs/actions/docker-push/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1>Description docker-push composite action</h1>

This action publishes a Docker image to a Docker registry. When this action is used on a tag branch, the image is tagged with <code>latest</code> and the tag version of the branch (e.g. <code>1.2.3</code>). For all other branches, the tag <code>pipeline-${{ github.run<em>id }}-git-${GITHUB</em>SHA::8}</code> is used as an image tag.
This action publishes a Docker image to a Docker registry. When this action is used on a tag branch, the image is tagged with <code>latest</code> and the tag version of the branch (e.g. <code>1.2.3</code>). For all other branches, the tag <code>pipeline-${{ github.run_id }}-git-${GITHUB_SHA::8}</code> is used as an image tag.

<h2>Prerequisites</h2>

Expand Down
2 changes: 1 addition & 1 deletion docs/actions/setup-credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
- name: Setup environment
uses: bakdata/ci-templates/actions/setup-credentials@main
with:
gke-service-account: ${{ secrets.GKE<em>SERVICE</em>ACCOUNT }}
gke-service-account: ${{ secrets.GKE_SERVICE_ACCOUNT }}
gke-project: "my-awesome-project"
gke-region: "us-west1"
gke-cluster: "my-awesome-cluster"
Expand Down
4 changes: 2 additions & 2 deletions docs/workflows/bump-version-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
changelog-config: "./.github/changelog-config.json" # (Optional)
working-directory: "." # (Optional) Default is .
secrets:
github-username: "${{ secrets.GH<em>USERNAME }}"
github-email: "${{ secrets.GH</em>EMAIL }}"
github-username: "${{ secrets.GH_USERNAME }}"
github-email: "${{ secrets.GH_EMAIL }}"
github-token: "${{ secrets.GH_TOKEN }}"

use-output-of-workflow:
Expand Down
4 changes: 2 additions & 2 deletions docs/workflows/docker-build-and-publish/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
image-artifact-name: "my-image-artifact"
working-directory: "."
secrets:
docker-user: "${{ secrets.DOCKER<em>USER }}"
docker-password: "${{ secrets.DOCKER</em>PWD }}"
docker-user: "${{ secrets.DOCKER_USER }}"
docker-password: "${{ secrets.DOCKER_PWD }}"
github-token: ${{ secrets.GH_TOKEN }}
```
Expand Down
8 changes: 4 additions & 4 deletions docs/workflows/helm-multi-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
subdirs: "['subdir1', 'subdir2', 'subdir3']"
gh-pages-branch: gh-pages
secrets:
github-email: "${{ secrets.GH<em>EMAIL }}"
github-username: "${{ secrets.GH</em>USERNAME }}"
github-email: "${{ secrets.GH_EMAIL }}"
github-username: "${{ secrets.GH_USERNAME }}"
github-token: "${{ secrets.GH_TOKEN }}"
```
Expand All @@ -72,8 +72,8 @@ jobs:
subdirs: "['.']"
gh-pages-branch: gh-pages
secrets:
github-email: "${{ secrets.GH<em>EMAIL }}"
github-username: "${{ secrets.GH</em>USERNAME }}"
github-email: "${{ secrets.GH_EMAIL }}"
github-username: "${{ secrets.GH_USERNAME }}"
github-token: "${{ secrets.GH_TOKEN }}"
```
Expand Down
8 changes: 4 additions & 4 deletions docs/workflows/helm-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Your Helm chart and <code>.bumpversion.cfg</code> need to be located inside the
current_version = 0.0.1
[bumpversion:file:charts/Chart.yaml]
search = version: {current<em>version}
replace = version: {new</em>version}
search = version: {current_version}
replace = version: {new_version}
```

Additionally, you need to create the lint configuration file <code>.github/lint-config.yaml</code> and configure it to your liking.
Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
skip-download: "false" # (Optional)
artifact-dir: "artifact" # (Optional)
secrets:
github-email: "${{ secrets.GH<em>EMAIL }}"
github-username: "${{ secrets.GH</em>USERNAME }}"
github-email: "${{ secrets.GH_EMAIL }}"
github-username: "${{ secrets.GH_USERNAME }}"
github-token: "${{ secrets.GH_TOKEN }}"
```
Expand Down
10 changes: 5 additions & 5 deletions docs/workflows/java-gradle-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ jobs:
gradle-cache: false # (Optional) Default is true
working-directory: "." # (Optional) Default is .
secrets:
sonar-token: ${{ secrets.SONARCLOUD<em>TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD</em>ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING<em>SECRET</em>KEY<em>RING }}
signing-key-id: ${{ secrets.SIGNING</em>KEY<em>ID }}
signing-password: ${{ secrets.SIGNING</em>PASSWORD }}
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING_SECRET_KEY_RING }}
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
```
<h2>References</h2>
Expand Down
22 changes: 11 additions & 11 deletions docs/workflows/java-gradle-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ jobs:
gradle-cache: false # (Optional) Default is true
working-directory: "." # (Optional) Default is .
secrets:
sonar-token: ${{ secrets.SONARCLOUD<em>TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD</em>ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING<em>SECRET</em>KEY<em>RING }}
signing-key-id: ${{ secrets.SIGNING</em>KEY<em>ID }}
signing-password: ${{ secrets.SIGNING</em>PASSWORD }}
ossrh-username: ${{ secrets.OSSHR<em>USERNAME }}
ossrh-password: ${{ secrets.OSSHR</em>PASSWORD }}
docker-username: ${{ secrets.DOCKERHUB<em>USERNAME }}
docker-password: ${{ secrets.DOCKERHUB</em>TOKEN }}
github-username: ${{ secrets.GH<em>USERNAME }}
github-token: ${{ secrets.GH</em>TOKEN }}
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING_SECRET_KEY_RING }}
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
ossrh-username: ${{ secrets.OSSHR_USERNAME }}
ossrh-password: ${{ secrets.OSSHR_PASSWORD }}
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
docker-password: ${{ secrets.DOCKERHUB_TOKEN }}
github-username: ${{ secrets.GH_USERNAME }}
github-token: ${{ secrets.GH_TOKEN }}
```
<h2>References</h2>
Expand Down
18 changes: 9 additions & 9 deletions docs/workflows/java-gradle-library/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ jobs:
gradle-cache: false # (Optional) Default is true
working-directory: "." # (Optional) Default is .
secrets:
sonar-token: ${{ secrets.SONARCLOUD<em>TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD</em>ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING<em>SECRET</em>KEY<em>RING }}
signing-key-id: ${{ secrets.SIGNING</em>KEY<em>ID }}
signing-password: ${{ secrets.SIGNING</em>PASSWORD }}
ossrh-username: ${{ secrets.OSSHR<em>USERNAME }}
ossrh-password: ${{ secrets.OSSHR</em>PASSWORD }}
github-username: ${{ secrets.GH<em>USERNAME }}
github-token: ${{ secrets.GH</em>TOKEN }}
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING_SECRET_KEY_RING }}
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
ossrh-username: ${{ secrets.OSSHR_USERNAME }}
ossrh-password: ${{ secrets.OSSHR_PASSWORD }}
github-username: ${{ secrets.GH_USERNAME }}
github-token: ${{ secrets.GH_TOKEN }}
```
<h2>References</h2>
Expand Down
22 changes: 11 additions & 11 deletions docs/workflows/java-gradle-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ jobs:
gradle-cache: false # (Optional) Default is true
working-directory: "." # (Optional) Default is .
secrets:
sonar-token: ${{ secrets.SONARCLOUD<em>TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD</em>ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING<em>SECRET</em>KEY<em>RING }}
signing-key-id: ${{ secrets.SIGNING</em>KEY<em>ID }}
signing-password: ${{ secrets.SIGNING</em>PASSWORD }}
ossrh-username: ${{ secrets.OSSHR<em>USERNAME }}
ossrh-password: ${{ secrets.OSSHR</em>PASSWORD }}
gradle-publish-key: ${{ secrets.GRADLE<em>PUBLISH</em>KEY }}
gradle-publish-secret: ${{ secrets.GRADLE<em>PUBLISH</em>SECRET }}
github-username: ${{ secrets.GH<em>USERNAME }}
github-token: ${{ secrets.GH</em>TOKEN }}
sonar-token: ${{ secrets.SONARCLOUD_TOKEN }}
sonar-organization: ${{ secrets.SONARCLOUD_ORGANIZATION }}
signing-secret-key-ring: ${{ secrets.SIGNING_SECRET_KEY_RING }}
signing-key-id: ${{ secrets.SIGNING_KEY_ID }}
signing-password: ${{ secrets.SIGNING_PASSWORD }}
ossrh-username: ${{ secrets.OSSHR_USERNAME }}
ossrh-password: ${{ secrets.OSSHR_PASSWORD }}
gradle-publish-key: ${{ secrets.GRADLE_PUBLISH_KEY }}
gradle-publish-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }}
github-username: ${{ secrets.GH_USERNAME }}
github-token: ${{ secrets.GH_TOKEN }}
```
<h2>References</h2>
Expand Down
4 changes: 2 additions & 2 deletions docs/workflows/java-gradle-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ jobs:
gradle-cache: false # (Optional) Default is true
working-directory: "." # (Optional) Default is .
secrets:
github-username: "${{ secrets.GH<em>USERNAME }}"
github-email: "${{ secrets.GH</em>EMAIL }}"
github-username: "${{ secrets.GH_USERNAME }}"
github-email: "${{ secrets.GH_EMAIL }}"
github-token: "${{ secrets.GH_TOKEN }}"

use-output-of-workflow:
Expand Down
8 changes: 4 additions & 4 deletions docs/workflows/kustomize-gke-deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ jobs:
kubectl-version: "v1.23.0" #optional
helm-version: "v3.8.1"
secrets:
gke-service-account: ${{ secrets.GKE<em>DEV</em>SERVICE<em>ACCOUNT }}
gke-project: ${{ secrets.GKE</em>DEV<em>PROJECT }}
gke-region: ${{ secrets.GKE</em>DEV<em>REGION }}
gke-cluster: ${{ secrets.GKE</em>DEV_CLUSTER }}
gke-service-account: ${{ secrets.GKE_DEV_SERVICE_ACCOUNT }}
gke-project: ${{ secrets.GKE_DEV_PROJECT }}
gke-region: ${{ secrets.GKE_DEV_REGION }}
gke-cluster: ${{ secrets.GKE_DEV_CLUSTER }}
```
<h2>References</h2>
Expand Down
8 changes: 4 additions & 4 deletions docs/workflows/kustomize-gke-destroy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
kubectl-version: "v1.23.0" #optional
helm-version: "v3.8.1" #optional
secrets:
gke-service-account: ${{ secrets.GKE<em>DEV</em>SERVICE<em>ACCOUNT }}
gke-project: ${{ secrets.GKE</em>DEV<em>PROJECT }}
gke-region: ${{ secrets.GKE</em>DEV<em>REGION }}
gke-cluster: ${{ secrets.GKE</em>DEV_CLUSTER }}
gke-service-account: ${{ secrets.GKE_DEV_SERVICE_ACCOUNT }}
gke-project: ${{ secrets.GKE_DEV_PROJECT }}
gke-region: ${{ secrets.GKE_DEV_REGION }}
gke-cluster: ${{ secrets.GKE_DEV_CLUSTER }}
```
<h2>References</h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/workflows/python-poetry-publish-snapshot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
poetry-version: "1.1.11" # (Optional) Default value is 1.5.1. In this case Poetry version 1.1.11 is installed
working-directory: "./my-awesome-python-project" # (Optional) Default value is the root directory of your repository. In this case all the files to the given path are published
secrets:
pypi-token: ${{ secrets.TEST<em>PYPI</em>TOKEN }}
pypi-token: ${{ secrets.TEST_PYPI_TOKEN }}
```
<h2>References</h2>
Expand Down
8 changes: 4 additions & 4 deletions docs/workflows/python-poetry-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ jobs:
uses: bakdata/ci-templates/.github/workflows/python-poetry-release.yaml@main
with:
release-type: patch # (Required) See more values at: https://python-poetry.org/docs/cli/#version
ref: my-awesome-ref # (Optional) if not set the ${{ github.event.repository.default<em>branch }} will fill the value. In this case the changes will be pushed to my-awesome-ref
ref: my-awesome-ref # (Optional) if not set the ${{ github.event.repository.default_branch }} will fill the value. In this case the changes will be pushed to my-awesome-ref
python-version: 3.8 # (Optional) Default value is 3.10. In this case Poetry is installed with Python 3.8
poetry-version: "1.1.11" # (Optional) Default value is 1.5.1. In this case Poetry version 1.1.11 is installed
working-directory: "./my-awesome-python-project" # (Optional) Default value is the root directory of your repository. In this case all the files to the given path are published
changelog: false # (Optional) Default to true.
changelog-config: ./my-changelog-config.json # (Optional) Set only if changelog is set to true. More information about it here https://github.com/bakdata/ci-templates/tree/main/actions/changelog-generate
secrets:
github-email: ${{ secrets.GH</em>EMAIL }}
github-username: ${{ secrets.GH<em>USERNAME }}
github-token: ${{ secrets.GH</em>TOKEN }}
github-email: ${{ secrets.GH_EMAIL }}
github-username: ${{ secrets.GH_USERNAME }}
github-token: ${{ secrets.GH_TOKEN }}

use-output-of-workflow:
runs-on: ubuntu-latest
Expand Down
16 changes: 8 additions & 8 deletions docs/workflows/release-tag-versions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ serialize =
[bumpversion:file:path/to/Chart.yaml]
search =
version: {current<em>version}
appVersion: {current</em>version}
version: {current_version}
appVersion: {current_version}
replace =
version: {new<em>version}
appVersion: {new</em>version}
version: {new_version}
appVersion: {new_version}
```

<h2>Dependencies</h2>
Expand All @@ -37,7 +37,7 @@ This workflow is built from multiple composite actions listed below:
<code>yaml
name: Release multiple Helm Charts
on:
workflow<em>dispatch:
workflow_dispatch:
inputs:
release-type:
description: "Scope of the release (major, minor or patch)."
Expand All @@ -57,9 +57,9 @@ jobs:
next-dev-release-type: "${{ inputs.next-dev-release-type }}"
next-dev-release-suffix: "SNAPSHOT"
secrets:
github-email: "${{ secrets.GH</em>EMAIL }}"
github-username: "${{ secrets.GH<em>USERNAME }}"
github-token: "${{ secrets.GH</em>TOKEN }}"
github-email: "${{ secrets.GH_EMAIL }}"
github-username: "${{ secrets.GH_USERNAME }}"
github-token: "${{ secrets.GH_TOKEN }}"
</code>

<h2>References</h2>
Expand Down

0 comments on commit 4881fed

Please sign in to comment.