Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
**/*.pyo
**/*.pyd
**/*.pkl
.python-version
.mypy_cache
_autosummary

Expand Down
28 changes: 8 additions & 20 deletions .github/actions/setup-python-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,16 @@ runs:
using: "composite"
# needs: comment-link-to-workflow # Ensure that a comment is posted with workflow id
steps:
# Step 1: Set up Python environment (Python 3.9.13).
- name: Set up Python
uses: actions/setup-python@v4
# Step 1: Set up Python environment
- name: "Set up Python"
uses: actions/setup-python@v6
with:
# Available versions: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
# Ensure to use a version that has support for arm64-darwin so we can build for Apple Silicon (macOS 14).
python-version: '3.9.13'
python-version-file: ".python-version"

# Step 2: Install pip-tools, which is used to generate hashed requirements.
# Note_1: pip 25.1 has a bug that causes pip-tools to fail with the following error:
# File ".../python3.9/site-packages/piptools/repositories/pypi.py", line 452, in allow_all_wheels
# self.finder.find_all_candidates.cache_clear()
# AttributeError: 'function' object has no attribute 'cache_clear'
# Note_2: Even though some wheels are guarded behind conditionals i.e. only use this if platform = linux;
# pip-tools 7.5.0 fails with the following error:
# pip._internal.exceptions.UnsupportedWheel: pyg_lib-0.4....linux_x86_64.whl is not a supported wheel on this platform.
# Thus, we fix the pip version to 25.0.1 and pip-tools version to 7.4.1.
- name: Install pip-tools
shell: bash
run: |
python -m pip install "pip==25.0.1"
python -m pip install "pip-tools==7.4.1"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "0.9.5" # Matches the version in install_py_deps.sh

# Step 3: Set up Gcloud AUTH using Workload Identity Federation
# See following for context: https://cloud.google.com/blog/products/identity-security/enabling-keyless-authentication-from-github-actions
Expand Down
7 changes: 5 additions & 2 deletions .github/cloud_builder/run_command_on_active_checkout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ substitutions:
options:
logging: CLOUD_LOGGING_ONLY
steps:
- name: us-central1-docker.pkg.dev/external-snap-ci-github-gigl/gigl-base-images/gigl-builder:6a94ae7cad3ec0c633246b0c9340a5095527deb9.63.2
- name: us-central1-docker.pkg.dev/external-snap-ci-github-gigl/gigl-base-images/gigl-builder:51af343c1c298ab465a96ecffd4e50ea6dffacb7.88.1
entrypoint: /bin/bash
args:
- -c
Expand All @@ -18,15 +18,18 @@ steps:

echo "Setting up environment..."
# gcloud runner will run as a non-root user, but all paths/profiles, etc are set up for root
mkdir -p /builder/home/.local/bin
cp -r /root/.local/bin/ /builder/home/.local/
echo "source /root/.bashrc" >> ~/.bashrc
echo "source /root/.profile" >> ~/.profile

source ~/.profile
docker version
docker buildx create --driver=docker-container --use
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
gcloud auth configure-docker us-central1-docker.pkg.dev
# Install GiGL
pip install -e ./python/
uv pip install -e .
# The builder operates in its own user dir, usually /workspace,
# so we need to copy the gigl tools dir to the current cloud_builder's user dir.
# See: containers/Dockerfile.builder.
Expand Down
15 changes: 15 additions & 0 deletions .github/scripts/update_docker_image_refs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# Script to update dep_vars.env and cloud builder config with new Docker image references

set -e

echo "Writing new image names to dep_vars.env:"
echo " DOCKER_LATEST_BASE_CUDA_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CUDA_IMAGE}"
echo " DOCKER_LATEST_BASE_CPU_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CPU_IMAGE}"
echo " DOCKER_LATEST_BASE_DATAFLOW_IMAGE_NAME_WITH_TAG=${GIGL_BASE_DATAFLOW_IMAGE}"
echo " DOCKER_LATEST_BUILDER_IMAGE_NAME_WITH_TAG=${GIGL_BUILDER_IMAGE}"

sed -i "s|^DOCKER_LATEST_BASE_CUDA_IMAGE_NAME_WITH_TAG=.*|DOCKER_LATEST_BASE_CUDA_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CUDA_IMAGE}|" dep_vars.env
sed -i "s|^DOCKER_LATEST_BASE_CPU_IMAGE_NAME_WITH_TAG=.*|DOCKER_LATEST_BASE_CPU_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CPU_IMAGE}|" dep_vars.env
sed -i "s|^DOCKER_LATEST_BASE_DATAFLOW_IMAGE_NAME_WITH_TAG=.*|DOCKER_LATEST_BASE_DATAFLOW_IMAGE_NAME_WITH_TAG=${GIGL_BASE_DATAFLOW_IMAGE}|" dep_vars.env
sed -i "s|name: us-central1-docker\.pkg\.dev.*|name: ${GIGL_BUILDER_IMAGE}|" .github/cloud_builder/run_command_on_active_checkout.yaml
57 changes: 35 additions & 22 deletions .github/workflows/build-base-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pr_number:
description: 'PR to run the workflow on'
required: true

env:
DOCKER_BUILDKIT: 1
GIGL_BASE_CUDA_IMAGE: us-central1-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/public-gigl/gigl-cuda-base:${{ github.sha }}.${{ github.run_number }}.${{ github.run_attempt }}
Expand All @@ -16,6 +17,7 @@ env:

jobs:
comment-workflow-started:

runs-on: ubuntu-latest
steps:
- name: Comment on PR
Expand All @@ -29,7 +31,7 @@ jobs:
Once done, the workflow will update the `dep_vars.env` file with the new image names.

build-cuda-base-image:
runs-on: gigl-large-instances # x64 Ubuntu:latest w/ 4 cores, 16GB RAM, 150 GB SSD
runs-on: gigl-large-instances # x64 Ubuntu:latest w/ 8-cores, 32GB RAM, 300 GB SSD
permissions:
# Needed for gcloud auth: https://github.com/google-github-actions/auth
contents: 'read'
Expand All @@ -41,7 +43,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ inputs.pr_number }}
- name: Setup Machine for building Docker images
uses: snapchat/gigl/.github/actions/setup-python-tools@main
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
try_cleaning_disk_space: "true"
Expand All @@ -56,8 +58,8 @@ jobs:
docker push ${GIGL_BASE_CUDA_IMAGE}
echo "Pushed CUDA base image to ${GIGL_BASE_CUDA_IMAGE}"

build-cpu-base-images:
runs-on: gigl-large-instances # x64 Ubuntu:latest w/ 4 cores, 16GB RAM, 150 GB SSD
build-cpu-base-image:
runs-on: ubuntu-latest
permissions:
# Needed for gcloud auth: https://github.com/google-github-actions/auth
contents: 'read'
Expand All @@ -69,14 +71,13 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ inputs.pr_number }}
- name: Setup Machine for building Docker images
uses: snapchat/gigl/.github/actions/setup-python-tools@main
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
try_cleaning_disk_space: "true"
gcp_project_id: ${{ vars.GCP_PROJECT_ID }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
gcp_service_account_email: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

- name: Build and Push CPU Base Image and Docker CPU Image
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev
Expand All @@ -85,8 +86,30 @@ jobs:
docker push ${GIGL_BASE_CPU_IMAGE}
echo "Pushed CPU base image to ${GIGL_BASE_CPU_IMAGE}"

echo "Will use CPU image ${GIGL_BASE_CPU_IMAGE} as base image for Dataflow image."
docker build -f ./containers/Dockerfile.dataflow.base --build-arg BASE_IMAGE=${GIGL_BASE_CPU_IMAGE} -t ${GIGL_BASE_DATAFLOW_IMAGE} .
build-dataflow-base-image:
runs-on: ubuntu-latest
permissions:
# Needed for gcloud auth: https://github.com/google-github-actions/auth
contents: 'read'
id-token: 'write'
steps:
- name: Checkout PR Branch
uses: snapchat/gigl/.github/actions/checkout-pr-branch@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ inputs.pr_number }}
- name: Setup Machine for building Docker images
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
try_cleaning_disk_space: "true"
gcp_project_id: ${{ vars.GCP_PROJECT_ID }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
gcp_service_account_email: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}
- name: Build and Push Dataflow Base Image
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev
docker build -f ./containers/Dockerfile.dataflow.base -t ${GIGL_BASE_DATAFLOW_IMAGE} .
docker push ${GIGL_BASE_DATAFLOW_IMAGE}
echo "Pushed Dataflow base image to ${GIGL_BASE_DATAFLOW_IMAGE}"

Expand All @@ -103,7 +126,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ inputs.pr_number }}
- name: Setup Machine for building Docker images
uses: snapchat/gigl/.github/actions/setup-python-tools@main
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
try_cleaning_disk_space: "true"
Expand All @@ -124,7 +147,8 @@ jobs:
build-and-commit-base-images:
needs:
- build-cuda-base-image
- build-cpu-base-images
- build-cpu-base-image
- build-dataflow-base-image
- build-builder-image
runs-on: ubuntu-latest
steps:
Expand All @@ -134,23 +158,12 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ inputs.pr_number }}
should_leave_progress_comments: "false"
command: |
echo "Writing new image names to dep_vars.env:"
echo " DOCKER_LATEST_BASE_CUDA_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CUDA_IMAGE}"
echo " DOCKER_LATEST_BASE_CPU_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CPU_IMAGE}"
echo " DOCKER_LATEST_BASE_DATAFLOW_IMAGE_NAME_WITH_TAG=${GIGL_BASE_DATAFLOW_IMAGE}"
echo " DOCKER_LATEST_BUILDER_IMAGE_NAME_WITH_TAG=${GIGL_BUILDER_IMAGE}"
sed -i "s|^DOCKER_LATEST_BASE_CUDA_IMAGE_NAME_WITH_TAG=.*|DOCKER_LATEST_BASE_CUDA_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CUDA_IMAGE}|" dep_vars.env
sed -i "s|^DOCKER_LATEST_BASE_CPU_IMAGE_NAME_WITH_TAG=.*|DOCKER_LATEST_BASE_CPU_IMAGE_NAME_WITH_TAG=${GIGL_BASE_CPU_IMAGE}|" dep_vars.env
sed -i "s|^DOCKER_LATEST_BASE_DATAFLOW_IMAGE_NAME_WITH_TAG=.*|DOCKER_LATEST_BASE_DATAFLOW_IMAGE_NAME_WITH_TAG=${GIGL_BASE_DATAFLOW_IMAGE}|" dep_vars.env
sed -i "s|name: us-central1-docker\.pkg\.dev.*|name: ${GIGL_BUILDER_IMAGE}|" .github/cloud_builder/run_command_on_active_checkout.yaml

command: bash .github/scripts/update_docker_image_refs.sh
- name: Commit and Push Dep Vars
uses: snapchat/gigl/.github/actions/commit-and-push@main
with:
commit_message: "[AUTOMATED] Update dep.vars, and other relevant files with new image names"
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: snapchat/gigl/.github/actions/comment-on-pr@main
with:
pr_number: ${{ inputs.pr_number }}
Expand Down
77 changes: 39 additions & 38 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Machine for bumping version
uses: snapchat/gigl/.github/actions/setup-python-tools@main
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
install_dev_deps: "true"
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Get current version
id: get_version
run: |
CURRENT_VERSION=$(python -m scripts.bump_version --get_current_version)
CURRENT_VERSION=$(uv run python -m scripts.bump_version --get_current_version)
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Current version: $CURRENT_VERSION"

Expand All @@ -70,23 +70,23 @@ jobs:
id: set_vars
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "bump_type=${{ github.event.inputs.bump_type }}" >> $GITHUB_OUTPUT
echo "bump_type=${{ inputs.bump_type }}" >> $GITHUB_OUTPUT
else
echo "bump_type=nightly" >> $GITHUB_OUTPUT
fi

# Perform the version bump
- name: Bump version
run: |
python -m scripts.bump_version \
uv run python -m scripts.bump_version \
--bump_type ${{ steps.set_vars.outputs.bump_type }} \
--project ${{ vars.GCP_PROJECT_ID }}

# Capture new version and create release branch name
- name: Get new version
id: get_new_version
run: |
NEW_VERSION=$(python -m scripts.bump_version --get_current_version)
NEW_VERSION=$(uv run python -m scripts.bump_version --get_current_version)
RELEASE_BRANCH_NAME="release/v${NEW_VERSION}"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "release_branch_name=$RELEASE_BRANCH_NAME" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:
ref: ${{ needs.bump_version.outputs.release_branch_name }}

- name: Setup Machine for release
uses: snapchat/gigl/.github/actions/setup-python-tools@main
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
install_dev_deps: "false"
Expand All @@ -139,37 +139,38 @@ jobs:
service_account: ${{ secrets.gcp_service_account_email }}
project: ${{ vars.GCP_PROJECT_ID }}

release_dev_workbench_image:
needs: bump_version
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write

steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ needs.bump_version.outputs.release_branch_name }}

- name: Setup Machine for workbench image release
uses: snapchat/gigl/.github/actions/setup-python-tools@main
with:
setup_gcloud: "true"
install_dev_deps: "false"
gcp_project_id: ${{ vars.GCP_PROJECT_ID }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
gcp_service_account_email: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

- name: Release Dev Workbench Image
uses: snapchat/gigl/.github/actions/run-cloud-run-command-on-active-checkout@main
with:
cmd: |
bash ./requirements/install_scala_deps.sh --download-only
make push_dev_workbench_docker_image
service_account: ${{ secrets.gcp_service_account_email }}
project: ${{ vars.GCP_PROJECT_ID }}
# TODO: (svij) Let's deprecate this as no one uses it beyond it being used for the TUT.
# release_dev_workbench_image:
# needs: bump_version
# runs-on: ubuntu-latest
# permissions:
# contents: write
# pull-requests: write
# id-token: write

# steps:
# - name: Checkout release branch
# uses: actions/checkout@v4
# with:
# ref: ${{ needs.bump_version.outputs.release_branch_name }}

# - name: Setup Machine for workbench image release
# uses: ./.github/actions/setup-python-tools
# with:
# setup_gcloud: "true"
# install_dev_deps: "false"
# gcp_project_id: ${{ vars.GCP_PROJECT_ID }}
# workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
# gcp_service_account_email: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}

# - name: Release Dev Workbench Image
# uses: snapchat/gigl/.github/actions/run-cloud-run-command-on-active-checkout@main
# with:
# cmd: |
# bash ./requirements/install_scala_deps.sh --download-only
# make push_dev_workbench_docker_image
# service_account: ${{ secrets.gcp_service_account_email }}
# project: ${{ vars.GCP_PROJECT_ID }}


# TODO: (svij) Also release the dev image
Expand All @@ -179,7 +180,7 @@ jobs:
needs:
- bump_version
- release_gigl_kfp_pipeline
- release_dev_workbench_image
# - release_dev_workbench_image
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nightly_release_&_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:
# Calls create_release w/ nightly and then run the api tests
jobs:
create-release:
uses: snapchat/gigl/.github/workflows/create_release.yml@main
uses: ./.github/workflows/create_release.yml
secrets: inherit
with:
bump_type: nightly
Expand All @@ -28,14 +28,14 @@ jobs:
with:
ref: ${{ needs.create-release.outputs.release_branch_name }}
- name: Setup development environment
uses: snapchat/gigl/.github/actions/setup-python-tools@main
uses: ./.github/actions/setup-python-tools
with:
setup_gcloud: "true"
gcp_project_id: ${{ vars.GCP_PROJECT_ID }}
workload_identity_provider: ${{ secrets.workload_identity_provider }}
gcp_service_account_email: ${{ secrets.gcp_service_account_email }}
- name: Run API Tests
uses: snapchat/gigl/.github/actions/run-cloud-run-command-on-active-checkout@main
uses: ./.github/actions/run-cloud-run-command-on-active-checkout
with:
cmd: "make run_api_test"
service_account: ${{ secrets.gcp_service_account_email }}
Expand Down
Loading