Trigger ontop-materialize job in k8s #54
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
# This workflow will run the ontop-materialize job in the identifiers kubernetes cluster | |
# which generates triples for the Identifiers registry ontologies | |
name: 'Trigger ontop-materialize job in k8s' | |
on: | |
schedule: | |
- cron: '0 7 * * *' # Run at 7:00 AM every day | |
push: | |
branches: | |
- main | |
jobs: | |
setup-build-publish-deploy: | |
name: 'Update triples and server' | |
runs-on: 'ubuntu-latest' | |
environment: 'production' | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: 'Checkout' | |
uses: 'actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332' # actions/checkout@v4 | |
# Configure Workload Identity Federation and generate an access token. | |
# | |
# See https://github.com/google-github-actions/auth for more options, | |
# including authenticating via a JSON credentials file. | |
- id: 'auth' | |
name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@f112390a2df9932162083945e46d439060d66ec2' # google-github-actions/auth@v2 | |
with: | |
project_id: '${{ secrets.GCP_PROJECT_ID }}' | |
workload_identity_provider: '${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}' | |
# Get the GKE credentials so we can deploy to the cluster | |
- name: 'Set up GKE credentials' | |
uses: 'google-github-actions/get-gke-credentials@6051de21ad50fbb1767bc93c11357a49082ad116' # google-github-actions/get-gke-credentials@v2 | |
with: | |
cluster_name: '${{ secrets.GKE_CLUSTER }}' | |
location: '${{ secrets.GCP_CLUSTER_LOCATION }}' | |
# Deploy the Docker image to the GKE cluster | |
- name: 'Update materialized triples job' | |
run: >- | |
kubectl -n hq delete -f ontop-k8s-job.yaml && | |
kubectl -n hq apply -f ontop-k8s-job.yaml && | |
kubectl -n hq wait --for=condition=complete --timeout=60s -f ontop-k8s-job.yaml | |
- name: 'Restart SPARQL server' | |
run: >- | |
kubectl -n satellite rollout restart deployment/sparql && | |
kubectl -n satellite rollout status deployment/sparql --timeout=60s | |