Repository navigation
Adds CI Improvements - Stage 2 #4877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
807a4ed
Remove redundant test result copying steps from CI workflow (implemen…
myurasov-nv 82350f6
Formatting
myurasov-nv 24e9526
Sync cuRobo abd Base dockerfiles
myurasov-nv 628c78e
Typos
myurasov-nv 5e96dee
FIx file copying
myurasov-nv 6801fb7
Remove hardcoded image tag
myurasov-nv 7ffefdc
Temporarily disable tasks, add toy task to debug ECR
myurasov-nv 2ddadc5
ECR Build-Push-Pull action (drop-in repl for docker-build)
myurasov-nv 356133e
Un-disable disabled workflows, disable toy one
myurasov-nv 579243d
Replace build jobs with ECR-backed ones; optimize task graph for maxi…
myurasov-nv 31e8912
Some docs for the action
myurasov-nv 035b08c
Make curobo build independet of base build
myurasov-nv d6ca913
More info mesages
myurasov-nv fc2a6c2
--format
myurasov-nv 1b4c0e0
Remove debugging ECR workflow
myurasov-nv 577c29b
Cleanup
myurasov-nv 8f14e6e
Typo
myurasov-nv 06769ff
Remove aws-region warning message from ECR action
myurasov-nv b66881c
Switch to Docker Buildx
myurasov-nv dcd0441
Separate layer cache images for base/curobo
myurasov-nv de80701
Add --platform, x86/adm64 fo now - for compatibility
myurasov-nv 799070f
Use unique builder names to avoid race conditions
myurasov-nv e6e909d
Reuse existing builder on workflow re-runs
myurasov-nv 8572535
Add cache tags for testing tasks
myurasov-nv 2b4cfa1
Add nvcr.io login step just in case
myurasov-nv 3da458a
Add comments for ECR image cleanup steps( for greptile!)
myurasov-nv 7f47022
Improve ECR image pull error handling and logging
myurasov-nv 5dc0277
Cleanup dependencies on the same like so image is slightly smaller
myurasov-nv e09aff9
Add cleanup for temporary Docker config directory on exit
myurasov-nv 06ad4ee
Use public IsacSim image in example
myurasov-nv c59b1b5
Copy rest of the files in a mo robust way
myurasov-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # ecr-build-push-pull | ||
|
|
||
| Action that ether builds Docker image and pushes it to ECR or pulls it from there. | ||
|
|
||
| ECR is also used as the BuildKit layer cache, so even first builds benefit from cached layers. | ||
|
|
||
| Drop-in replacement for `docker-build/action.yml` with ECR-backed caching. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| The runner must be authenticated to AWS; the action calls | ||
| `aws sts get-caller-identity` and `aws ecr get-login-password` using whatever credentials | ||
| are available in the environment. | ||
|
|
||
| The IAM role must have at minimum: | ||
| - `ecr:GetAuthorizationToken` (on `*`) | ||
| - `ecr:BatchCheckLayerAvailability`, `ecr:GetDownloadUrlForLayer`, `ecr:BatchGetImage` (pull) | ||
| - `ecr:InitiateLayerUpload`, `ecr:UploadLayerPart`, `ecr:CompleteLayerUpload`, `ecr:PutImage` (push) | ||
|
|
||
| ## Inputs | ||
|
|
||
| | Input | Required | Default | Description | | ||
| |-------|----------|---------|-------------| | ||
| | `image-tag` | yes | — | Local Docker tag (e.g. `isaac-lab-dev:pr-1-abc`) | | ||
| | `isaacsim-base-image` | yes | — | IsaacSim base image (`ISAACSIM_BASE_IMAGE_ARG` build-arg) | | ||
| | `isaacsim-version` | yes | — | IsaacSim version (`ISAACSIM_VERSION_ARG` build-arg) | | ||
| | `dockerfile-path` | no | `docker/Dockerfile.base` | Path to Dockerfile | | ||
| | `ecr-repository` | no | `""` | ECR repo name. If omitted, ECR push/pull/cache is skipped. | | ||
| | `aws-region` | no | `us-west-2` | ECR region. Should match the runner's EC2 region for best performance. | | ||
|
|
||
| ## Usage | ||
|
|
||
| ```yaml | ||
| - uses: ./.github/actions/ecr-build-push-pull | ||
| with: | ||
| image-tag: ${{ env.DOCKER_IMAGE_TAG }} | ||
| isaacsim-base-image: nvcr.io/nvidia/isaac-sim | ||
| isaacsim-version: 6.0.0 | ||
| dockerfile-path: docker/Dockerfile.base | ||
| ecr-repository: isaaclab-ci | ||
| aws-region: us-west-2 | ||
| ``` |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| # Copyright (c) 2022-2026, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| name: 'ECR Build-Push-Pull' | ||
| description: > | ||
| Builds a Docker image and pushes it to ECR, using ECR as the layer cache. | ||
| If the image already exists in ECR (same tag), pulls it instead of building. | ||
| Drop-in replacement for docker-build/action.yml with ECR-backed caching. | ||
|
|
||
| inputs: | ||
| image-tag: | ||
| description: 'Tag for the Docker image (e.g. my-image:latest).' | ||
| required: true | ||
| isaacsim-base-image: | ||
| description: 'IsaacSim base image (passed as ISAACSIM_BASE_IMAGE_ARG build-arg).' | ||
| required: true | ||
| isaacsim-version: | ||
| description: 'IsaacSim version (passed as ISAACSIM_VERSION_ARG build-arg).' | ||
| required: true | ||
| dockerfile-path: | ||
| description: 'Path to Dockerfile, relative to the repository root' | ||
| default: 'docker/Dockerfile.base' | ||
| required: false | ||
| ecr-repository: | ||
| description: 'ECR repository name. If omitted, ECR push/pull/cache is skipped and the image is always built.' | ||
| required: false | ||
| default: '' | ||
| cache-tag: | ||
| description: > | ||
| Tag used for the ECR layer cache image (e.g. "cache-base", "cache-curobo"). | ||
| required: false | ||
| default: 'cache' | ||
| aws-region: | ||
| description: > | ||
| AWS region (e.g. us-west-2, etc). | ||
| For best performance, should match the runner EC2 region. | ||
| required: false | ||
| default: 'us-west-2' | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: ECR Build, Push, Pull | ||
| shell: bash | ||
| run: | | ||
| IMAGE_TAG="${{ inputs.image-tag }}" | ||
| ECR_REPOSITORY="${{ inputs.ecr-repository }}" | ||
| AWS_REGION="${{ inputs.aws-region }}" | ||
|
|
||
| if [ -z "${ECR_REPOSITORY}" ]; then | ||
| echo "🟠 ecr-repository not set, skipping ECR login/push/pull. Building locally only." | ||
| else | ||
| # Get AWS account ID from the runner's IAM instance profile | ||
| AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) | ||
| REGISTRY="${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com" | ||
|
|
||
| # Derive ECR image tag by slugifying the local image-tag | ||
| # (colons/slashes not valid in ECR tags) | ||
| ECR_TAG=$(echo "${IMAGE_TAG}" | tr ':/' '--') | ||
| ECR_IMAGE="${REGISTRY}/${ECR_REPOSITORY}:${ECR_TAG}" | ||
| CACHE_IMAGE="${REGISTRY}/${ECR_REPOSITORY}:${{ inputs.cache-tag }}" | ||
|
|
||
| # The runner's credential store is broken ("not implemented"), so use a temp config dir | ||
| # with credsStore disabled. Copy existing ~/.docker/config.json first to preserve other | ||
| # registry auths (e.g. nvcr.io), then strip credsStore/credHelpers. | ||
| # | ||
| DOCKER_CONFIG_DIR=$(mktemp -d) | ||
| trap 'rm -rf "${DOCKER_CONFIG_DIR}"' EXIT | ||
| if [ -f "${HOME}/.docker/config.json" ]; then | ||
| python3 -c "import json; cfg=json.load(open('${HOME}/.docker/config.json')); cfg['credsStore']=''; cfg.pop('credHelpers',None); json.dump(cfg,open('${DOCKER_CONFIG_DIR}/config.json','w'))" | ||
| else | ||
| echo '{"credsStore":""}' > "${DOCKER_CONFIG_DIR}/config.json" | ||
| fi | ||
| # | ||
| # Export so all subsequent docker calls in this job inherit it | ||
| echo "DOCKER_CONFIG=${DOCKER_CONFIG_DIR}" >> "$GITHUB_ENV" | ||
| export DOCKER_CONFIG="${DOCKER_CONFIG_DIR}" | ||
|
myurasov-nv marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Login to ECR registry with token provided by aws cli | ||
| echo "🟢 Logging into ECR registry..." | ||
| aws ecr get-login-password --region "${AWS_REGION}" | \ | ||
| docker login --username AWS --password-stdin "${REGISTRY}" | ||
|
|
||
| # Try pulling the exact image from ECR to skip the build | ||
| echo "🟢 Checking for existing image ${ECR_IMAGE} in ECR..." | ||
| PULL_OUTPUT=$(docker pull "${ECR_IMAGE}" 2>&1) && { | ||
| echo "🟢 Image found in ECR, pulled: ${ECR_IMAGE}" | ||
| docker tag "${ECR_IMAGE}" "${IMAGE_TAG}" | ||
| echo "🟢 Tagged as: ${IMAGE_TAG} — skipping build." | ||
| exit 0 | ||
| } || { | ||
| echo "🟠 Image not pulled (will build instead): ${PULL_OUTPUT}" | ||
| } | ||
| fi | ||
|
|
||
| # Log into nvcr.io so the Dockerfile can pull nvcr.io base images. | ||
| # Credential is written into the temp config dir when ECR is enabled, | ||
| # and into the default config when it is not. | ||
| if [ -n "${{ env.NGC_API_KEY }}" ]; then | ||
| echo "🟢 Logging into nvcr.io..." | ||
| docker login -u \$oauthtoken -p ${{ env.NGC_API_KEY }} nvcr.io | ||
| else | ||
| echo "🟠 NGC_API_KEY not set — skipping nvcr.io login (normal for fork PRs)" | ||
| fi | ||
|
myurasov-nv marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Build the image | ||
|
|
||
| BUILD_ARGS=( | ||
| --progress=plain | ||
| --platform linux/amd64 | ||
| -f "${{ inputs.dockerfile-path }}" | ||
| --build-arg "ISAACSIM_BASE_IMAGE_ARG=${{ inputs.isaacsim-base-image }}" | ||
| --build-arg "ISAACSIM_VERSION_ARG=${{ inputs.isaacsim-version }}" | ||
| --build-arg "ISAACSIM_ROOT_PATH_ARG=/isaac-sim" | ||
| --build-arg "ISAACLAB_PATH_ARG=/workspace/isaaclab" | ||
| --build-arg "DOCKER_USER_HOME_ARG=/root" | ||
| -t "${IMAGE_TAG}" | ||
| ) | ||
|
|
||
| # Add ECR layer caching | ||
| if [ -n "${ECR_REPOSITORY}" ]; then | ||
| BUILD_ARGS+=( | ||
| --cache-from "type=registry,ref=${CACHE_IMAGE}" | ||
| --cache-to "type=registry,ref=${CACHE_IMAGE},mode=max" | ||
| -t "${ECR_IMAGE}" | ||
| ) | ||
| fi | ||
|
|
||
| # Set up buildx builder with docker-container driver (required for registry cache export). | ||
| BUILDER_NAME="ci-builder-${{ github.run_id }}-${{ github.job }}" | ||
|
|
||
| # Create builder (or fall back to reusing existing one on workflow re-runs) | ||
| docker buildx create --use --driver docker-container --name "${BUILDER_NAME}" \ | ||
| || docker buildx use "${BUILDER_NAME}" | ||
|
|
||
| echo "🟢 Building ${IMAGE_TAG}..." | ||
| docker buildx build --load "${BUILD_ARGS[@]}" . | ||
|
myurasov-nv marked this conversation as resolved.
Resolved
|
||
|
|
||
| # Clean up builder | ||
| docker buildx rm "${BUILDER_NAME}" || true | ||
|
|
||
| echo "🟢 Build completed for ${IMAGE_TAG}, pushing to ECR..." | ||
|
|
||
| if [ -n "${ECR_REPOSITORY}" ]; then | ||
| docker push "${ECR_IMAGE}" | ||
| echo "🟢 Pushed ${ECR_IMAGE} to ECR" | ||
| fi | ||
|
|
||
| echo "🟢 Image ${IMAGE_TAG} is ready!" | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.