feat: add command line tool for triggering sqlmesh migrate in the k8s… #880
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
name: warehouse-publish-docker-containers | |
env: | |
X_GITHUB_GRAPHQL_API: ${{ vars.X_GITHUB_GRAPHQL_API }} | |
X_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# This workflow only runs when a commit is completed on main. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
push: | |
branches: | |
- main | |
jobs: | |
warehouse-publish-docker-containers: | |
name: warehouse-publish-docker-containers | |
environment: indexer | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: 'read' | |
id-token: 'write' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup Python and UV | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: uv sync --all-packages --all-extras | |
- name: 'Login to GitHub Container Registry' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Package and publish other docker containers | |
run: bash .github/scripts/publish-docker-containers.sh | |
# The remaining steps currently kill a pods in our kubernetes | |
# because we haven't dealt with using strict versions on the cluster yet. | |
# This ensures the pods are up to date. This is a hack for now. | |
- uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_JSON }}' | |
create_credentials_file: true | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v2' | |
with: | |
version: '>= 363.0.0' | |
# Get the GKE credentials so we can deploy to the cluster | |
- uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f | |
with: | |
cluster_name: ${{ secrets.GKE_CLUSTER_NAME }} | |
location: ${{ secrets.GKE_CLUSTER_REGION }} | |
project_id: ${{ vars.GOOGLE_PROJECT_ID }} | |
# We may need a better place for this in the future but for now we need to | |
# ensure that sqlmesh state is up to date _before_ we deploy the new | |
# containers | |
- name: Run sqlmesh migrate | |
run: uv run oso production sqlmesh-migrate | |
- name: Delete pod for dagster | |
run: kubectl delete pods --namespace production-dagster -l app.kubernetes.io/instance=production-dagster,component=user-deployments |