From e538e76c04242c7ab312f4bf816e6220d08b5b02 Mon Sep 17 00:00:00 2001 From: Junya Morioka Date: Thu, 4 Dec 2025 15:39:36 +0900 Subject: [PATCH] feat: add authorization for self-hosted runner --- .github/workflows/test-self-hosted-linux.yml | 7 +++--- self-hosted-runner/Dockerfile | 25 +++++++++++++++----- self-hosted-runner/compose.yml | 6 +++-- self-hosted-runner/env.template | 2 ++ 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-self-hosted-linux.yml b/.github/workflows/test-self-hosted-linux.yml index d3a8d65..6ad3410 100644 --- a/.github/workflows/test-self-hosted-linux.yml +++ b/.github/workflows/test-self-hosted-linux.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: flash-attn-version: ["2.8.0"] - python-version: ["3.11"] + python-version: ["3.11", "3.12"] torch-version: ["2.7.1"] # https://developer.nvidia.com/cuda-toolkit-archive cuda-version: ["12.8.1"] @@ -92,6 +92,7 @@ jobs: - name: Build wheels timeout-minutes: 1200 + id: build_wheels shell: bash env: MAX_JOBS: 4 @@ -105,7 +106,8 @@ jobs: - name: Install Test shell: bash run: | - pip install --no-cache-dir --force-reinstall flash-attention/dist/${{ env.wheel_name }} + pip uninstall -y flash-attn > /dev/null 2>&1 + pip install --no-cache-dir flash-attention/dist/${{ steps.build_wheels.outputs.WHEEL_NAME }} python -c "import flash_attn; print(flash_attn.__version__)" - name: Clean up @@ -113,4 +115,3 @@ jobs: if: always() run: | rm -rf /opt/hostedtoolcache/Python - rm -rf ~/.cache/pip diff --git a/self-hosted-runner/Dockerfile b/self-hosted-runner/Dockerfile index f231690..1e69b5a 100644 --- a/self-hosted-runner/Dockerfile +++ b/self-hosted-runner/Dockerfile @@ -1,12 +1,13 @@ FROM ubuntu:24.04 -ARG REPOSITORY_URL -ARG PERSONAL_ACCESS_TOKEN -ARG GH_RUNNER_VERSION="2.324.0" +ARG REPOSITORY_URL="https://github.com/user/repo" +ARG GH_RUNNER_VERSION="2.329.0" ARG RUNNER_NAME="self-hosted-github-actions-runner" ARG RUNNER_GROUP="default" ARG RUNNER_LABELS="self-hosted,Linux" ARG TARGET_ARCH="x64" +ARG PERSONAL_ACCESS_TOKEN="" +ARG REGISTRY_TOKEN="" ENV DEBIAN_FRONTEND=noninteractive \ AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache @@ -65,14 +66,26 @@ RUN curl -fsSL -o actions-runner.tar.gz -L "https://github.com/actions/runner/re && tar xf actions-runner.tar.gz \ && rm actions-runner.tar.gz \ && sudo ./bin/installdependencies.sh \ - && ./config.sh \ + && if [ -n "$PERSONAL_ACCESS_TOKEN" ]; then \ + ./config.sh \ --unattended \ --url $REPOSITORY_URL \ - --pat $PERSONAL_ACCESS_TOKEN \ + --pat "$PERSONAL_ACCESS_TOKEN" \ --name $RUNNER_NAME \ --runnergroup $RUNNER_GROUP \ --labels "${RUNNER_LABELS},${TARGET_ARCH}" \ --work /home/ubuntu/actions-runner \ - --replace + --replace; \ + else \ + ./config.sh \ + --unattended \ + --url $REPOSITORY_URL \ + --token "$REGISTRY_TOKEN" \ + --name $RUNNER_NAME \ + --runnergroup $RUNNER_GROUP \ + --labels "${RUNNER_LABELS},${TARGET_ARCH}" \ + --work /home/ubuntu/actions-runner \ + --replace; \ + fi CMD ["./run.sh"] diff --git a/self-hosted-runner/compose.yml b/self-hosted-runner/compose.yml index c4e92ab..b7c82b6 100644 --- a/self-hosted-runner/compose.yml +++ b/self-hosted-runner/compose.yml @@ -2,14 +2,16 @@ services: runner: privileged: true restart: always + env_file: + - .env build: context: . dockerfile: Dockerfile args: REPOSITORY_URL: https://github.com/mjun0812/flash-attention-prebuild-wheels PERSONAL_ACCESS_TOKEN: $PERSONAL_ACCESS_TOKEN - GH_RUNNER_VERSION: 2.327.1 + GH_RUNNER_VERSION: 2.329.0 RUNNER_NAME: self-hosted-runner RUNNER_GROUP: default - RUNNER_LABELS: self-hosted + RUNNER_LABELS: self-hosted,Linux TARGET_ARCH: x64 diff --git a/self-hosted-runner/env.template b/self-hosted-runner/env.template index cf1aca7..923ae88 100644 --- a/self-hosted-runner/env.template +++ b/self-hosted-runner/env.template @@ -1 +1,3 @@ PERSONAL_ACCESS_TOKEN= +REGISTRY_TOKEN= +RUNNER_LABELS=Linux,self-hosted \ No newline at end of file