-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,199 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ alpline | |
.* | ||
tests | ||
*-example.toml | ||
.golangci.yml | ||
*.md | ||
*.pc | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Description | ||
|
||
<!--- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> | ||
|
||
Fixes # (issue) | ||
|
||
## Type of change | ||
|
||
Please delete options that are not relevant. | ||
|
||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] This change requires a documentation update | ||
|
||
# How Has This Been Tested? | ||
|
||
<!--- Please describe in detail how you tested your changes. --> | ||
<!--- Include details of your testing environment, and the tests you ran to --> | ||
<!--- see how your change affects other areas of the code, etc. --> | ||
|
||
## Screenshots (if appropriate): | ||
|
||
# Checklist: | ||
|
||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] I have made corresponding changes to the documentation | ||
- [ ] My changes generate no new warnings | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] New and existing unit tests pass locally with my changes | ||
- [ ] Any dependent changes have been merged and published in downstream modules | ||
- [ ] Updated version in Makefile respecting [semver v2](https://semver.org/spec/v2.0.0.html) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
# Check for updates to GitHub Actions every weekday | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## I'm submitting a ... | ||
|
||
- [ ] bug report | ||
- [ ] feature request | ||
|
||
## What is the current behavior? | ||
|
||
## If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem | ||
|
||
## What is the expected behavior? | ||
|
||
## What is the motivation / use case for changing the behavior? | ||
|
||
## Please tell us about your environment: | ||
|
||
Version: X.Y.Z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"go-version": "1.19.4", | ||
"deploy": { | ||
"pull-request": true, | ||
"sign-docker-image": false, | ||
"pull-request-images": [ | ||
{ | ||
"name": "ubuntu" | ||
} | ||
], | ||
"release-images": [ | ||
{ | ||
"name": "ubuntu" | ||
}, | ||
{ | ||
"name": "oraclelinux" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: "[Manual] Pull Request Cleanup" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pattern: | ||
description: | | ||
Tags pattern filter | ||
required: true | ||
type: string | ||
default: "rc.pr-" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
env: | ||
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | ||
PULL_REQUEST_BRANCH: ${{ github.head_ref }} | ||
IMAGE_NAME: "ghcr.io/${{ github.repository }}" | ||
PACKAGE_NAME: oracledb_exporter | ||
PACKAGE_TYPE: container | ||
USERNAME: ${{ github.repository_owner }} | ||
|
||
jobs: | ||
cleanup-ghcr: | ||
runs-on: ubuntu-latest | ||
name: "cleanup ghcr / ${{ github.event.inputs.pattern }}" | ||
steps: | ||
- name: Cleanup versions | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FILTER: ${{ github.event.inputs.pattern }} | ||
run: | | ||
gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/users/${{ env.USERNAME }}/packages/${{ env.PACKAGE_TYPE }}/${{ env.PACKAGE_NAME }}/versions" > versions.json | ||
VERSIONS=$(jq -r '.[] | select(.metadata.container.tags[] | test("${{ env.FILTER }}")) | .id' versions.json) | ||
for VERSION in $(echo -n "$VERSIONS") | ||
do | ||
TAG=$(jq -r \ | ||
--arg VERSION "$VERSION" \ | ||
'.[] | select(.id | tostring | test($VERSION)) | .metadata.container.tags | join(",")' \ | ||
versions.json | ||
) | ||
DIGEST=$(jq -r \ | ||
--arg VERSION "$VERSION" \ | ||
'.[] | select(.id | tostring | test($VERSION)) | .name' \ | ||
versions.json | ||
) | ||
echo "deleting ${IMAGE_NAME}:${TAG} with digest=${DIGEST}" | ||
echo "deleting package PACKAGE_VERSION_ID=${VERSION}" | ||
# https://github.com/cli/cli/issues/3937 | ||
echo -n | gh api \ | ||
--silent \ | ||
--method DELETE \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/users/${{ env.USERNAME }}/packages/${{ env.PACKAGE_TYPE }}/${{ env.PACKAGE_NAME }}/versions/$VERSION" \ | ||
--input - | ||
done | ||
cleanup-pre-releases: | ||
runs-on: ubuntu-latest | ||
name: "cleanup pre-releases / ${{ github.event.inputs.pattern }}" | ||
steps: | ||
- name: Cleanup releases | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FILTER: ${{ github.event.inputs.pattern }} | ||
run: | | ||
gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/repos/${{ github.repository }}/releases" \ | ||
--jq='.[] | select(.prerelease=false) | select(.tag_name | test("${{ env.FILTER }}"))' > versions.json | ||
VERSIONS=$(jq -r '.id' versions.json) | ||
for VERSION in $(echo -n "$VERSIONS") | ||
do | ||
RELEASE=$(jq -r \ | ||
--arg VERSION "$VERSION" \ | ||
'select(.id | tostring | test($VERSION)) | .name' \ | ||
versions.json | ||
) | ||
echo "deleting release \"$RELEASE\" with RELEASE_ID=${VERSION}" | ||
# https://github.com/cli/cli/issues/3937 | ||
echo -n | gh api \ | ||
--silent \ | ||
--method DELETE \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/repos/${{ github.repository }}/releases/$VERSION" \ | ||
--input - | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Pull Request Cleanup | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
env: | ||
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | ||
PULL_REQUEST_BRANCH: ${{ github.head_ref }} | ||
IMAGE_NAME: "ghcr.io/${{ github.repository }}" | ||
PACKAGE_NAME: oracledb_exporter | ||
PACKAGE_TYPE: container | ||
USERNAME: ${{ github.repository_owner }} | ||
|
||
jobs: | ||
cleanup-ghcr: | ||
runs-on: ubuntu-latest | ||
name: "cleanup ghcr" | ||
steps: | ||
- name: Cleanup versions | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FILTER: rc.pr-${{ env.PULL_REQUEST_NUMBER }} | ||
run: | | ||
gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/users/${{ env.USERNAME }}/packages/${{ env.PACKAGE_TYPE }}/${{ env.PACKAGE_NAME }}/versions" > versions.json | ||
VERSIONS=$(jq -r '.[] | select(.metadata.container.tags[] | test("${{ env.FILTER }}")) | .id' versions.json) | ||
for VERSION in $(echo -n "$VERSIONS") | ||
do | ||
TAG=$(jq -r \ | ||
--arg VERSION "$VERSION" \ | ||
'.[] | select(.id | tostring | test($VERSION)) | .metadata.container.tags | join(",")' \ | ||
versions.json | ||
) | ||
DIGEST=$(jq -r \ | ||
--arg VERSION "$VERSION" \ | ||
'.[] | select(.id | tostring | test($VERSION)) | .name' \ | ||
versions.json | ||
) | ||
echo "deleting ${IMAGE_NAME}:${TAG} with digest=${DIGEST}" | ||
echo "deleting package PACKAGE_VERSION_ID=${VERSION}" | ||
# https://github.com/cli/cli/issues/3937 | ||
echo -n | gh api \ | ||
--silent \ | ||
--method DELETE \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/users/${{ env.USERNAME }}/packages/${{ env.PACKAGE_TYPE }}/${{ env.PACKAGE_NAME }}/versions/$VERSION" \ | ||
--input - | ||
done | ||
cleanup-pre-releases: | ||
runs-on: ubuntu-latest | ||
name: "cleanup pre-releases" | ||
steps: | ||
- name: Cleanup releases | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
FILTER: rc.pr-${{ env.PULL_REQUEST_NUMBER }} | ||
run: | | ||
gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/repos/${{ github.repository }}/releases" \ | ||
--jq='.[] | select(.prerelease=false) | select(.tag_name | test("${{ env.FILTER }}"))' > versions.json | ||
VERSIONS=$(jq -r '.id' versions.json) | ||
for VERSION in $(echo -n "$VERSIONS") | ||
do | ||
RELEASE=$(jq -r \ | ||
--arg VERSION "$VERSION" \ | ||
'select(.id | tostring | test($VERSION)) | .name' \ | ||
versions.json | ||
) | ||
echo "deleting release \"$RELEASE\" with RELEASE_ID=${VERSION}" | ||
# https://github.com/cli/cli/issues/3937 | ||
echo -n | gh api \ | ||
--silent \ | ||
--method DELETE \ | ||
-H "Accept: application/vnd.github+json" \ | ||
"/repos/${{ github.repository }}/releases/$VERSION" \ | ||
--input - | ||
done |
Oops, something went wrong.