From dc2dceb7959df9d450cb648e1998f62fa0d20fbd Mon Sep 17 00:00:00 2001 From: Morgan Funtowicz Date: Wed, 29 Jan 2025 10:30:07 +0100 Subject: [PATCH 1/8] misc(gha): expose action cache url and runtime as secrets --- .github/workflows/build.yaml | 1 + Dockerfile_trtllm | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 73a55efe..7edbf993 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -191,6 +191,7 @@ jobs: PLATFORM=${{ env.PLATFORM }} build_type=${{ env.BUILD_TYPE }} sccache_gha_enabled=on + secrets: actions_cache_url=${{ env.ACTIONS_CACHE_URL }} actions_runtime_token=${{ env.ACTIONS_RUNTIME_TOKEN }} diff --git a/Dockerfile_trtllm b/Dockerfile_trtllm index 6538996a..e15051c0 100644 --- a/Dockerfile_trtllm +++ b/Dockerfile_trtllm @@ -64,12 +64,12 @@ WORKDIR /usr/src/text-generation-inference ARG cuda_arch_list ARG build_type ARG sccache_gha_enabled -ARG actions_cache_url -ARG actions_runtime_token # Install Rust ENV PATH="/root/.cargo/bin:$PATH" -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \ +RUN --mount=type=secret,id=actions_cache_url,env=ACTIONS_CACHE_URL \ + --mount=type=secret,id=actions_runtime_token,env=ACTIONS_RUNTIME_TOKEN \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \ chmod -R a+w /root/.rustup && \ chmod -R a+w /root/.cargo && \ cargo install sccache --locked From c94c544d7d80b37ac66470189672e802bbbbefd4 Mon Sep 17 00:00:00 2001 From: Guillaume LEGENDRE Date: Wed, 29 Jan 2025 11:31:11 +0100 Subject: [PATCH 2/8] (CI): Move S3 Auth to OIDC --- .github/workflows/build.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7edbf993..bdd987ad 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -150,6 +150,14 @@ jobs: username: ${{ secrets.AZURE_DOCKER_USERNAME }} password: ${{ secrets.AZURE_DOCKER_PASSWORD }} registry: db4c2190dd824d1f950f5d1555fbadf0.azurecr.io + - name: configure aws credentials + uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 + with: + role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_BUILDX_CACHE }} + role-duration-seconds: 7200 + aws-region: us-east1 + output-credentials: true + # If pull request - name: Extract metadata (tags, labels) for Docker if: ${{ github.event_name == 'pull_request' }} @@ -180,6 +188,8 @@ jobs: - name: Build and push Docker image id: build-and-push uses: docker/build-push-action@v4 + env: + DOCKER_BUILD_SUMMARY: false with: context: . file: ${{ env.DOCKERFILE }} @@ -197,8 +207,8 @@ jobs: tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} - cache-from: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=max - cache-to: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_ACCESS_KEY_ID }},secret_access_key=${{ secrets.S3_CI_DOCKER_BUILDX_CACHE_SECRET_ACCESS_KEY }},mode=max + cache-from: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max + cache-to: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max - name: Final id: final run: | From 967f6bf4c21eed8d05dc7b790c4f7b2986ec19ac Mon Sep 17 00:00:00 2001 From: Guillaume LEGENDRE Date: Wed, 29 Jan 2025 11:40:30 +0100 Subject: [PATCH 3/8] Fix Typo --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bdd987ad..61aa1d6d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -155,7 +155,7 @@ jobs: with: role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_BUILDX_CACHE }} role-duration-seconds: 7200 - aws-region: us-east1 + aws-region: us-east-1 output-credentials: true # If pull request From 16d5376f9577b27c90d0b0dfccbca8d3fa380bd8 Mon Sep 17 00:00:00 2001 From: Guillaume LEGENDRE Date: Wed, 29 Jan 2025 12:03:06 +0100 Subject: [PATCH 4/8] change bucket name --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 61aa1d6d..9674923a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -207,8 +207,8 @@ jobs: tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} - cache-from: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max - cache-to: type=s3,region=us-east-1,bucket=ci-docker-buildx-cache,name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max + cache-from: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max + cache-to: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max - name: Final id: final run: | From 57c7ae2ef8b64feebd2fc0ca55d22c51df2500d7 Mon Sep 17 00:00:00 2001 From: Guillaume LEGENDRE Date: Wed, 29 Jan 2025 12:09:02 +0100 Subject: [PATCH 5/8] fix aws auth creds --- .github/workflows/build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9674923a..2e0714b7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -151,6 +151,7 @@ jobs: password: ${{ secrets.AZURE_DOCKER_PASSWORD }} registry: db4c2190dd824d1f950f5d1555fbadf0.azurecr.io - name: configure aws credentials + id: aws-creds uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 with: role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_BUILDX_CACHE }} @@ -207,8 +208,8 @@ jobs: tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} - cache-from: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max - cache-to: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.creds.outputs.aws-secret-access-key }},mode=max + cache-from: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.aws-creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.aws-creds.outputs.aws-secret-access-key }},mode=max + cache-to: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.aws-creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.aws-creds.outputs.aws-secret-access-key }},mode=max - name: Final id: final run: | From 62a3b78deb38ff4d2678bb4c2396285aa245e449 Mon Sep 17 00:00:00 2001 From: Morgan Funtowicz Date: Wed, 29 Jan 2025 13:49:12 +0100 Subject: [PATCH 6/8] misc(gha): fix invalid syntax for secrets --- .github/workflows/build.yaml | 2 +- Dockerfile_trtllm | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 2e0714b7..f39733df 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -202,7 +202,7 @@ jobs: PLATFORM=${{ env.PLATFORM }} build_type=${{ env.BUILD_TYPE }} sccache_gha_enabled=on - secrets: + secrets: | actions_cache_url=${{ env.ACTIONS_CACHE_URL }} actions_runtime_token=${{ env.ACTIONS_RUNTIME_TOKEN }} diff --git a/Dockerfile_trtllm b/Dockerfile_trtllm index e15051c0..158d52b8 100644 --- a/Dockerfile_trtllm +++ b/Dockerfile_trtllm @@ -67,9 +67,7 @@ ARG sccache_gha_enabled # Install Rust ENV PATH="/root/.cargo/bin:$PATH" -RUN --mount=type=secret,id=actions_cache_url,env=ACTIONS_CACHE_URL \ - --mount=type=secret,id=actions_runtime_token,env=ACTIONS_RUNTIME_TOKEN \ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \ +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y && \ chmod -R a+w /root/.rustup && \ chmod -R a+w /root/.cargo && \ cargo install sccache --locked @@ -83,8 +81,6 @@ ENV CUDA_ARCH_LIST=${cuda_arch_list} # SCCACHE Specifics args - before finding a better, more generic, way... ENV SCCACHE_GHA_ENABLED=${sccache_gha_enabled} -ENV ACTIONS_CACHE_URL=${actions_cache_url} -ENV ACTIONS_RUNTIME_TOKEN=${actions_runtime_token} COPY Cargo.lock Cargo.lock COPY Cargo.toml Cargo.toml @@ -98,7 +94,9 @@ COPY --from=mpi-builder /usr/local/mpi /usr/local/mpi ENV RUSTC_WRAPPER=sccache ENV CMAKE_INSTALL_PREFIX=$TGI_INSTALL_PREFIX -RUN export CMAKE_C_COMPILER_LAUNCHER=sccache && \ +RUN --mount=type=secret,id=actions_cache_url,env=ACTIONS_CACHE_URL \ + --mount=type=secret,id=actions_runtime_token,env=ACTIONS_RUNTIME_TOKEN \ + export CMAKE_C_COMPILER_LAUNCHER=sccache && \ export CMAKE_CXX_COMPILER_LAUNCHER=sccache && \ export CMAKE_CUDA_COMPILER_LAUNCHER=sccache && \ mkdir $TGI_INSTALL_PREFIX && mkdir "$TGI_INSTALL_PREFIX/include" && mkdir "$TGI_INSTALL_PREFIX/lib" && \ From 2446d240aad15d24cff2881ea10be2c7f732f530 Mon Sep 17 00:00:00 2001 From: Guillaume LEGENDRE Date: Wed, 29 Jan 2025 15:17:38 +0100 Subject: [PATCH 7/8] WIP: Add AWS session token --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f39733df..0681faa0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -208,8 +208,8 @@ jobs: tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} - cache-from: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.aws-creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.aws-creds.outputs.aws-secret-access-key }},mode=max - cache-to: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.aws-creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.aws-creds.outputs.aws-secret-access-key }},mode=max + cache-from: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.aws-creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.aws-creds.outputs.aws-secret-access-key }},session_token=${{ steps.aws-creds.outputs.aws-session-token }},mode=max + cache-to: type=s3,region=us-east-1,bucket=${{ vars.AWS_S3BUCKET_GITHUB_BUILDX_CACHE }},name=text-generation-inference-cache${{ env.LABEL }},mode=min,access_key_id=${{ steps.aws-creds.outputs.aws-access-key-id }},secret_access_key=${{ steps.aws-creds.outputs.aws-secret-access-key }},session_token=${{ steps.aws-creds.outputs.aws-session-token }},mode=max - name: Final id: final run: | From 4e1c68e6f82179aaf3ecdac30350a31d15097164 Mon Sep 17 00:00:00 2001 From: Guillaume LEGENDRE Date: Thu, 30 Jan 2025 09:53:28 +0100 Subject: [PATCH 8/8] Increase session time --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0681faa0..99674172 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -155,7 +155,7 @@ jobs: uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 with: role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_BUILDX_CACHE }} - role-duration-seconds: 7200 + role-duration-seconds: 18000 aws-region: us-east-1 output-credentials: true