Skip to content

fix: stale-on-append datatree cache + graceful datetime sel (#118) #660

fix: stale-on-append datatree cache + graceful datetime sel (#118)

fix: stale-on-append datatree cache + graceful datetime sel (#118) #660

Workflow file for this run

name: Docker and Helm
on:
schedule:
- cron: "0 10 * * *"
push:
branches:
- main
pull_request:
# Trigger on GitHub releases created by Release Please
release:
types: [published]
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
- name: Docker meta
id: meta
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=sha
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/main' }}
# For release events, extract version from release tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
- name: Authenticate with GitHub Packages
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build and push Docker image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
helm:
runs-on: ubuntu-latest
needs: docker
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.9.2
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.12"
- name: Set up chart-testing
uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --chart-dirs helm --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Check Version
if: steps.list-changed.outputs.changed == 'true'
run: |
"$pythonLocation/bin/python" -m pip install -e .
"$pythonLocation/bin/python" -m pip install pyyaml
"$pythonLocation/bin/python" .github/workflows/scripts/check_version.py
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --chart-dirs helm --target-branch ${{ github.event.repository.default_branch }}
- name: Authenticate with GitHub Packages
if: steps.list-changed.outputs.changed == 'true'
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: downcase REPO
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: SHA Tag
id: vars
run: echo "sha_tag=sha-$(git rev-parse --short HEAD)" >>${GITHUB_ENV}
- name: Pull Docker image
if: steps.list-changed.outputs.changed == 'true'
run: |
docker pull ghcr.io/${{ env.REPO }}:${{ env.sha_tag }}
docker tag ghcr.io/${{ env.REPO }}:${{ env.sha_tag }} titiler-eopf:ci
- name: Create kind cluster
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
if: steps.list-changed.outputs.changed == 'true'
- name: Load container image in kind cluster
run: kind load docker-image titiler-eopf:ci --name chart-testing
if: steps.list-changed.outputs.changed == 'true'
- name: Create Namespace
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create namespace titiler-eopf
- name: Create Secret
if: steps.list-changed.outputs.changed == 'true'
run: |
kubectl create secret generic titiler-eopf-secret -n titiler-eopf --from-literal=AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} --from-literal=AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install --chart-dirs helm --namespace titiler-eopf
# delete the pull request docker image to free up space
- name: Delete Docker image
if: always()
run: |
docker rmi ghcr.io/${{ env.REPO }}:${{ env.sha_tag }} || echo "Image not found, skipping deletion."