Move containers to seperate repository

This commit is contained in:
kjeld Schouten-Lebbing
2021-09-10 12:09:01 +02:00
parent ea9f4e7a6b
commit 76d1d303fd
43 changed files with 0 additions and 919 deletions
-180
View File
@@ -1,180 +0,0 @@
name: "Containers: Test-and-Build"
on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'containers/apps/**'
- 'containers/base/**'
- 'containers/dev/**'
- ".github/workflows/containers.build.yaml"
pull_request:
paths:
- 'containers/apps/**'
- 'containers/base/**'
- 'containers/dev/**'
- ".github/workflows/containers.build.yaml"
env:
# How long to sleep before running the tests (gives the application time to start)
GOSS_SLEEP: 30
# Detect which folders in project-root (which contain the containers) contain changes
jobs:
changes:
name: Get changes
runs-on: ubuntu-20.04
outputs:
matrix: "{\"container\": ${{ steps.reduce.outputs.containers }} }"
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
list-files: json
filters: |
changed:
- 'containers/apps/**'
- 'containers/base/**'
- 'containers/dev/**'
- run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json
- id: reduce
run: |
CONTAINERS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+\/(?<third_directory>(?<root3>[\/]?)[^\/]+)(?<extra_paths>.+)))"; "\(.third_directory)") | unique' changes.json)
echo ::set-output name=containers::${CONTAINERS}
hadolint:
name: Run hadolint
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: hadolint
uses: reviewdog/action-hadolint@v1.25.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
filter_mode: diff_context
fail_on_error: true
build:
name: Build
runs-on: ubuntu-20.04
needs:
- hadolint
- changes
strategy:
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
fail-fast: false
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
steps:
- name: Checkout
uses: actions/checkout@v2
# Define if tests and push should be run against which versions/platforms
- name: Prepare
id: prep
run: |
if test -f "./containers/apps/${{ matrix.container }}/Dockerfile"; then
CATEGORY="apps"
elif test -f "./containers/dev/${{ matrix.container }}/Dockerfile"; then
CATEGORY="dev"
else
CATEGORY="base"
fi
echo ::set-output name=category::${CATEGORY}
VERSION=$(cat ./containers/${CATEGORY}/${{ matrix.container }}/VERSION)
echo ::set-output name=version::${VERSION}
PLATFORM="linux/amd64"
echo ::set-output name=platform::${PLATFORM}
if test -f "./containers/${CATEGORY}/${{ matrix.container }}/goss.yaml"; then
echo ::set-output name=goss::true
else
echo ::set-output name=goss::false
fi
if [ "${{github.event_name}}" == "pull_request" ]; then
echo ::set-output name=push::false
echo ::set-output name=cache_from::"type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:buildcache" || echo ::set-output name=cache_from::""
echo ::set-output name=cache_to::""
else
echo ::set-output name=push::true
echo ::set-output name=cache_from::"type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:buildcache"
echo ::set-output name=cache_to::"type=registry,ref=ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:buildcache,mode=max"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: amd64
- name: Login to GHCR
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
# Install and configure Buildx
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
driver-opts: image=moby/buildkit:master
# Install the GOSS testing framework
- name: Set up goss/dgoss
uses: e1himself/goss-installation-action@v1.0.3
if: ${{ steps.prep.outputs.goss == 'true' }}
with:
version: 'v0.3.16'
# Creates a local build to run tests on
- name: Build and Load local test-container
if: ${{ steps.prep.outputs.goss == 'true' }}
uses: docker/build-push-action@v2
with:
build-args: VERSION=${{ steps.prep.outputs.version }}
context: .
file: ./containers/${{ steps.prep.outputs.category }}/${{ matrix.container }}/Dockerfile
load: true
tags: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:test
cache-from: ${{ steps.prep.outputs.cache_from }}
cache-to: ${{ steps.prep.outputs.cache_to }}
# Run GOSS tests if included with the container
- name: Run GOSS tests
if: ${{ steps.prep.outputs.goss == 'true' }}
env:
GOSS_FILE: ./containers/${{ steps.prep.outputs.category }}/${{ matrix.container }}/goss.yaml
run: |
dgoss run ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:test
# Push if not a PR, otherwise just test the build process for all requested platforms
- name: Build and Push
uses: docker/build-push-action@v2
with:
build-args: VERSION=${{ steps.prep.outputs.version }}
context: .
platforms: ${{ steps.prep.outputs.platform }}
file: ./containers/${{ steps.prep.outputs.category }}/${{ matrix.container }}/Dockerfile
push: ${{ steps.prep.outputs.push }}
tags: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:latest
ghcr.io/${{ github.repository_owner }}/${{ matrix.container }}:v${{ steps.prep.outputs.version }}
cache-from: ${{ steps.prep.outputs.cache_from }}
cache-to: ${{ steps.prep.outputs.cache_to }}
container-build-complete:
needs: [build]
name: Container Build Completed
runs-on: ubuntu-latest
steps:
- name: complete message
run: echo "Container Build and Tests Completed Successfully"
-164
View File
@@ -1,164 +0,0 @@
name: "Housekeeping"
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/housekeeping.yaml"
schedule:
- cron: "0 3 * * *"
jobs:
housekeeping:
runs-on: ubuntu-latest
name: "Housekeeping"
steps:
- name: Checkout branch
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pybump
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: install helm-docs
run: |
brew install norwoodj/tap/helm-docs
- name: Containers - Fetch new application versions
run: |
find ./containers/apps -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | while read app; do
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
done
- name: Containers - Fetch new base versions
run: |
find ./containers/base -maxdepth 1 -mindepth 1 -type d -exec basename {} \; | while read app; do
if test -f "./containers/base/${app}/latest-version.sh"; then
version=$(bash "./containers/base/${app}/latest-version.sh")
if [[ ! -z "${version}" || "${version}" != "null" ]]; then
echo "${version}" | tee "./containers/base/${app}/VERSION" > /dev/null
echo "${app} ${version}"
fi
fi
done
- name: update versions in docs
run: |
for train in stable incubator; do
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
maxchartversion=$(cat ${chart}/Chart.yaml | grep "^version: " | awk -F" " '{ print $2 }')
chartname=$(basename ${chart})
echo "Copying templates to ${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="README.md" \
--template-files="/home/runner/work/apps/apps/templates/docs/README.md.gotmpl" \
--chart-search-root="${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="CONFIG.md" \
--template-files="/home/runner/work/apps/apps/templates/docs/CONFIG.md.gotmpl" \
--chart-search-root="${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="app-readme.md" \
--template-files="/home/runner/work/apps/apps/templates/docs/app-readme.md.gotmpl" \
--chart-search-root="${chart}"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="helm-values.md" \
--template-files="/home/runner/work/apps/apps/templates/docs/helm-values.md.gotmpl" \
--chart-search-root="${chart}"
fi
done
done
- name: generate common docs
run: |
mkdir -p docs/apps/common || echo "common path already exists, continuing..."
echo "Copying common templates to docs"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="README.md" \
--template-files="/home/runner/work/apps/apps/templates/docs/common-README.md.gotmpl" \
--chart-search-root="/home/runner/work/apps/apps/charts/library/common"
helm-docs \
--ignore-file=".helmdocsignore" \
--output-file="helm-values.md" \
--template-files="/home/runner/work/apps/apps/templates/docs/common-helm-values.md.gotmpl" \
--chart-search-root="/home/runner/work/apps/apps/charts/library/common"
- name: run pre-commit checks
continue-on-error: true
uses: pre-commit/action@v2.0.3
- name: Copy general readme to website
run: |
yes | cp -rf index.yaml docs/index.yaml || echo "chart-index copy failed, continuing..."
yes | cp -rf .github/README.md docs/index.md || echo "readme copy failed, continuing..."
sed -i '1s/^/---\nhide:\n - navigation\n - toc\n---\n/' docs/index.md
sed -i 's~<!-- INSERT-DISCORD-WIDGET -->~<iframe src="https://discord.com/widget?id=830763548678291466\&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>~g' docs/index.md
yes | cp -rf .github/CODE_OF_CONDUCT docs/about/code_of_conduct.md || echo "CODE_OF_CONDUCT copy failed, continuing..."
yes | cp -rf .github/CONTRIBUTING docs/development/contributing.md || echo "CONTRIBUTING copy failed, continuing..."
yes | cp -rf .github/SUPPORT.md docs/manual/SUPPORT.md || echo "support policy copy failed, continuing..."
yes | cp -rf LICENSE docs/about/legal/LICENSE.md || echo "license copy failed, continuing..."
sed -i '1s/^/# License<br>\n\n/' docs/about/legal/LICENSE.md
yes | cp -rf NOTICE docs/about/legal/NOTICE.md || echo "license copy failed, continuing..."
sed -i '1s/^/# NOTICE<br>\n\n/' docs/about/legal/NOTICE.md
ls docs/
- name: Copy Apps readme to website
run: |
for train in stable incubator; do
for chart in charts/${train}/*; do
if [ -d "${chart}" ]; then
chartname=$(basename ${chart})
echo "Processing: ${chart}"
mkdir -p docs/apps/${train}/${chartname} || echo "app path already exists, continuing..."
yes | cp -rf ${chart}/README.md docs/apps/${train}/${chartname}/index.md || echo "readme copy failed, continuing..."
yes | cp -rf ${chart}/CONFIG.md docs/apps/${train}/${chartname}/CONFIG.md || echo "config copy failed, continuing..."
yes | cp -rf ${chart}/helm-values.md docs/apps/${train}/${chartname}/helm-values.md || echo "config copy failed, continuing..."
sed -i '1s/^/# License<br>\n\n/' docs/apps/${train}/${chartname}/LICENSE.md || echo "license edit failed, continuing..."
fi
done
echo "Processed charts for ${train}:"
ls docs/apps/${train}/ || echo "no Apps in train"
done
mkdir -p docs/apps/common || echo "common docs path already exists, continuing..."
yes | cp -rf charts/library/common/README.md docs/apps/common/index.md || echo "common readme copy failed, continuing..."
yes | cp -rf charts/library/common/helm-values.md docs/apps/common/helm-values.md || echo "common readme copy failed, continuing..."
- name: Commit and Push Housekeeping
run: |
git config user.name "TrueCharts-Bot"
git config user.email "bot@truecharts.org"
git add --all
git commit -sm "Daily Housekeeping" || exit 0
git push