From 82262d1b1df7df29cb4e6ff6557b9b62a958cb36 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Mon, 7 Oct 2024 19:41:13 +0200 Subject: [PATCH] initial work on adding container CI --- .github/scripts/update-version-file.sh | 21 ++++++++++ .../workflows/containers.housekeeping.yaml | 2 +- .../workflows/containers.scarf.yaml | 4 +- containers/.github/label-commenter-config.yml | 34 ----------------- containers/.github/stale.yml | 32 ---------------- containers/.github/update-version-file.sh | 21 ---------- .../.github/workflows/containers.build.yaml | 20 +++++----- .../workflows/schedule-sync-labels.yaml | 25 ------------ containers/.github/workflows/stale.yaml | 38 ------------------- 9 files changed, 34 insertions(+), 163 deletions(-) create mode 100755 .github/scripts/update-version-file.sh rename containers/.github/workflows/housekeeping.yaml => .github/workflows/containers.housekeeping.yaml (93%) rename containers/.github/workflows/scarf.yaml => .github/workflows/containers.scarf.yaml (92%) delete mode 100644 containers/.github/label-commenter-config.yml delete mode 100644 containers/.github/stale.yml delete mode 100755 containers/.github/update-version-file.sh delete mode 100644 containers/.github/workflows/schedule-sync-labels.yaml delete mode 100644 containers/.github/workflows/stale.yaml diff --git a/.github/scripts/update-version-file.sh b/.github/scripts/update-version-file.sh new file mode 100755 index 00000000000..20569126cbd --- /dev/null +++ b/.github/scripts/update-version-file.sh @@ -0,0 +1,21 @@ +#/bin/bash + +app="${1}" + +if test -f "/containers/apps/${app}/latest-version.sh"; then + version=$(bash "/containers/apps/${app}/latest-version.sh") + if [[ ! -z "${version}" || "${version}" != "null" ]]; then + echo "${version}" | tee "/containers/apps/${app}/VERSION" >/dev/null + echo "App: ${app} using version: ${version}" + fi +fi + +if test -f "/containers/apps/${app}/BASE"; then + if test -f "/containers/apps/${app}/latest-base.sh"; then + base=$(bash "/containers/apps/${app}/latest-base.sh") + if [[ ! -z "${base}" || "${base}" != "null" ]]; then + echo "${base}" | tee "/containers/apps/${app}/BASE" >/dev/null + echo "App: ${app} using Base: ${base}" + fi + fi +fi diff --git a/containers/.github/workflows/housekeeping.yaml b/.github/workflows/containers.housekeeping.yaml similarity index 93% rename from containers/.github/workflows/housekeeping.yaml rename to .github/workflows/containers.housekeeping.yaml index 45803de6835..c34141a2791 100644 --- a/containers/.github/workflows/housekeeping.yaml +++ b/.github/workflows/containers.housekeeping.yaml @@ -24,7 +24,7 @@ jobs: - name: Containers - Fetch new application versions run: | find ./apps -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | while read app; do - bash ./.github/update-version-file.sh "${app}" + bash ./.github/scripts/update-version-file.sh "${app}" done - name: Commit and Push Housekeeping diff --git a/containers/.github/workflows/scarf.yaml b/.github/workflows/containers.scarf.yaml similarity index 92% rename from containers/.github/workflows/scarf.yaml rename to .github/workflows/containers.scarf.yaml index 643197bb876..59ec74ce0cb 100644 --- a/containers/.github/workflows/scarf.yaml +++ b/.github/workflows/containers.scarf.yaml @@ -24,8 +24,8 @@ jobs: CT="Content-Type:application/json" for group in apps dev mirror base; do - for i in ${group}/*; do - PLAIN=$( echo $i | cut -d'/' -f2 ) + for i in containers/${group}/*; do + PLAIN=$( echo $i | cut -d'/' -f3 ) data='{"name":"tccr/'${PLAIN}'","backendUrl":"https://quay.io/tccr/'${PLAIN}'","longDescription":"","shortDescription":"example description","website":"https://truecharts.org","libraryType":"docker","publicUrl":"https://tccr.io/tccr/'${PLAIN}'"}' url="https://scarf.sh/api/v1/packages" diff --git a/containers/.github/label-commenter-config.yml b/containers/.github/label-commenter-config.yml deleted file mode 100644 index d705f6e8bee..00000000000 --- a/containers/.github/label-commenter-config.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -labels: - - name: incomplete-template - labeled: - issue: - body: | - :wave: @{{ issue.user.login }}, please follow the template provided. - action: close - locking: lock - lock_reason: resolved - - - name: support - labeled: - issue: - body: | - :wave: @{{ issue.user.login }}, we use the issue tracker exclusively - for bug reports and feature requests. However, this issue appears - to be a support request. Please use our support channels - to get help. - - [Docs](https://https://truecharts.org/) - - [Discord](https://discord.gg/tVsPTHWTtr) - action: close - - - name: incomplete-docs - labeled: - pr: - body: | - :wave: @{{ pull_request.user.login }}, thanks for taking the time to submit this PR. 🙏🏽 - - We have noticed that the chart documentation has not been completely updated for this PR. - Could you please make sure that the following items have been updated: - - `version` in `Chart.yaml` has been updated per [semver](http://semver.org/) - - The `artifacthub.io/changes` chart annotation contains a summary of the updates for this new version. See [Artifact Hub documentation](https://artifacthub.io/docs/topics/annotations/helm/#supported-annotations) for more info. - - [Documentation strings](https://github.com/norwoodj/helm-docs#valuesyaml-metadata) have been added to the keys in `values.yaml`. diff --git a/containers/.github/stale.yml b/containers/.github/stale.yml deleted file mode 100644 index 616be956c3f..00000000000 --- a/containers/.github/stale.yml +++ /dev/null @@ -1,32 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 45 - -# Number of days of inactivity before a stale Issue or Pull Request is closed. -daysUntilClose: 5 - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: -- on-hold -- pinned - -# Label to use when marking as stale -staleLabel: stale - -issues: - # Comment to post when marking as stale. Set to `false` to disable - markComment: > - This Issue has been automatically marked as "stale" because it has not had recent activity (for 45 days). It will be closed if no further activity occurs. Thanks for the feedback. - # Comment to post when closing a stale Issue or Pull Request. - closeComment: > - Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary. -pulls: - # Comment to post when marking as stale. Set to `false` to disable - markComment: > - This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 45 days). It will be closed if no further activity occurs. Thank you for your contribution. - # Comment to post when closing a stale Issue or Pull Request. - closeComment: > - Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary. -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 diff --git a/containers/.github/update-version-file.sh b/containers/.github/update-version-file.sh deleted file mode 100755 index d11a847a6bc..00000000000 --- a/containers/.github/update-version-file.sh +++ /dev/null @@ -1,21 +0,0 @@ -#/bin/bash - -app="${1}" - -if test -f "/apps/${app}/latest-version.sh"; then - version=$(bash "/apps/${app}/latest-version.sh") - if [[ ! -z "${version}" || "${version}" != "null" ]]; then - echo "${version}" | tee "/apps/${app}/VERSION" >/dev/null - echo "App: ${app} using version: ${version}" - fi -fi - -if test -f "/apps/${app}/BASE"; then - if test -f "/apps/${app}/latest-base.sh"; then - base=$(bash "/apps/${app}/latest-base.sh") - if [[ ! -z "${base}" || "${base}" != "null" ]]; then - echo "${base}" | tee "/apps/${app}/BASE" >/dev/null - echo "App: ${app} using Base: ${base}" - fi - fi -fi diff --git a/containers/.github/workflows/containers.build.yaml b/containers/.github/workflows/containers.build.yaml index 7abe9586c46..ad52d4017ad 100644 --- a/containers/.github/workflows/containers.build.yaml +++ b/containers/.github/workflows/containers.build.yaml @@ -6,8 +6,8 @@ on: branches: - master paths: - - 'apps/**' - - 'base/**' + - 'containers/apps/**' + - 'containers/base/**' - ".github/workflows/containers.build.yaml" pull_request: paths: @@ -37,9 +37,9 @@ jobs: list-files: json filters: | changed: - - 'apps/**' - - 'dev/**' - - 'base/**' + - 'containers/apps/**' + - 'containers/dev/**' + - 'containers/base/**' - run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json - id: reduce run: | @@ -88,11 +88,11 @@ jobs: bash ./.github/update-version-file.sh "${{ matrix.container }}" if test -f "./apps/${{ matrix.container }}/VERSION"; then CATEGORY="apps" - VERSION=$(cat ./${CATEGORY}/${{ matrix.container }}/VERSION) - elif test -f "./apps/${{ matrix.container }}/Dockerfile"; then + VERSION=$(cat ./containers/${CATEGORY}/${{ matrix.container }}/VERSION) + elif test -f "./containers/apps/${{ matrix.container }}/Dockerfile"; then CATEGORY="apps" echo ::set-output name=category::${CATEGORY} - VERSION="$(head -1 ./${CATEGORY}/${{ matrix.container }}/Dockerfile | cut -d'@' -f1 | sed 's/^FROM.*://' )" + VERSION="$(head -1 ./containers/${CATEGORY}/${{ matrix.container }}/Dockerfile | cut -d'@' -f1 | sed 's/^FROM.*://' )" VERSION=$(echo $VERSION | sed "s/latest-//g") VERSION=$(echo $VERSION | sed "s/stable-//g") VERSION=$(echo $VERSION | sed "s/edge-//g") @@ -121,7 +121,7 @@ jobs: fi; else CATEGORY="base" - VERSION=$(cat ./${CATEGORY}/${{ matrix.container }}/VERSION) || VERSION="$(head -1 ./${CATEGORY}/${{ matrix.container }}/Dockerfile | cut -d'@' -f1 | sed 's/^FROM.*://' )" + VERSION=$(cat ./containers/${CATEGORY}/${{ matrix.container }}/VERSION) || VERSION="$(head -1 ./containers/${CATEGORY}/${{ matrix.container }}/Dockerfile | cut -d'@' -f1 | sed 's/^FROM.*://' )" VERSION=$(echo $VERSION | sed "s/latest-//g") VERSION=$(echo $VERSION | sed "s/stable-//g") VERSION="${VERSION#*V.}" @@ -157,7 +157,7 @@ jobs: git config user.name "TrueCharts-Bot" git config user.email "bot@truecharts.org" # add only VERSION and BASE files - git add ./apps/${{ matrix.container }}/VERSION ./apps/${{ matrix.container }}/BASE || true + git add ./containers/apps/${{ matrix.container }}/VERSION ./containers/apps/${{ matrix.container }}/BASE || true git commit -sm "Update ${{ matrix.container }} version file" || exit 0 git push diff --git a/containers/.github/workflows/schedule-sync-labels.yaml b/containers/.github/workflows/schedule-sync-labels.yaml deleted file mode 100644 index cc366b1730c..00000000000 --- a/containers/.github/workflows/schedule-sync-labels.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: "Schedule: Sync labels" - -on: # yamllint disable-line rule:truthy - workflow_dispatch: - schedule: - - cron: "0 * * * *" - -jobs: - labels: - name: Sync Labels - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - token: ${{ secrets.BOT_TOKEN }} - - - name: Sync Labels - uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2 - with: - config-file: | - https://raw.githubusercontent.com/truecharts/.github/main/.github/labels.yaml - token: "${{ secrets.BOT_TOKEN }}" - delete-other-labels: true diff --git a/containers/.github/workflows/stale.yaml b/containers/.github/workflows/stale.yaml deleted file mode 100644 index cd1f5f747a6..00000000000 --- a/containers/.github/workflows/stale.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: "Mark or close stale issues and PRs" -on: - workflow_dispatch: - schedule: - # Run the stalebot every day at 8pm UTC - - cron: "00 20 * * *" - -jobs: - stale: - runs-on: ubuntu-24.04 - steps: - - name: Check for stale issues and PRs - uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9 - with: - repo-token: ${{ secrets.BOT_TOKEN }} - days-before-issue-stale: 180 - days-before-pr-stale: 180 - days-before-close: 14 - days-before-pr-close: 14 - stale-issue-message: > - This issue has been automatically marked as stale because it has not had recent activity. - It will be closed in two weeks if no further activity occurs. - Thank you for your contributions. - stale-pr-message: > - This pull request has been automatically marked as stale because it has not had - recent activity. It will be closed in two weeks if no further activity occurs. - Thank you for your contributions. - close-issue-message: > - This issue has been automatically closed due to inactivity. - Please re-open if this still requires investigation. - close-pr-message: > - This pull request has been automatically closed due to inactivity. - Please re-open if these changes are still required. - stale-pr-label: "stale" - stale-issue-label: "stale" - exempt-issue-labels: "keepalive" - exempt-pr-labels: "keepalive"