Skip to content

Commit 94dca4b

Browse files
committed
[CI] Fix docker file and action credential issue
1 parent b01daa6 commit 94dca4b

5 files changed

Lines changed: 26 additions & 22 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,17 @@ jobs:
5353
5454
# Step 4: Build and Push Docker Image
5555
- name: Build and Push Docker Image
56-
uses: docker/build-push-action@v4
57-
env:
58-
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
56+
uses: docker/build-push-action@v6
5957
with:
6058
context: .
6159
file: ./Dockerfile
6260
push: true
6361
build-args: |
6462
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
6563
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
66-
GIT_ACCESS_TOKEN=${{ env.GIT_ACCESS_TOKEN }}
6764
TORCHSIM_SHA=${{ env.GITHUB_SHA }}
65+
secrets: |
66+
GIT_ACCESS_TOKEN=${{ secrets.GIT_ACCESS_TOKEN }}
6867
tags: ghcr.io/psal-postech/${{ env.IMAGE_TAG }}
6968

7069
test_add:

.github/workflows/pull-request.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,17 @@ jobs:
5353
5454
# Step 4: Build and Push Docker Image
5555
- name: Build and Push Docker Image
56-
uses: docker/build-push-action@v4
57-
env:
58-
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
56+
uses: docker/build-push-action@v6
5957
with:
6058
context: .
6159
file: ./Dockerfile
6260
push: true
6361
build-args: |
6462
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
6563
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
66-
GIT_ACCESS_TOKEN=${{ env.GIT_ACCESS_TOKEN }}
6764
TORCHSIM_SHA=${{ env.GITHUB_SHA }}
65+
secrets: |
66+
GIT_ACCESS_TOKEN=${{ secrets.GIT_ACCESS_TOKEN }}
6867
tags: ghcr.io/psal-postech/${{ env.IMAGE_TAG}}
6968

7069
test_add:

.github/workflows/pull-request_mobile.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,17 @@ jobs:
5353
5454
# Step 4: Build and Push Docker Image
5555
- name: Build and Push Docker Image
56-
uses: docker/build-push-action@v4
57-
env:
58-
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
56+
uses: docker/build-push-action@v6
5957
with:
6058
context: .
6159
file: ./Dockerfile
6260
push: true
6361
build-args: |
6462
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
6563
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
66-
GIT_ACCESS_TOKEN=${{ env.GIT_ACCESS_TOKEN }}
6764
TORCHSIM_SHA=${{ env.GITHUB_SHA }}
65+
secrets: |
66+
GIT_ACCESS_TOKEN=${{ secrets.GIT_ACCESS_TOKEN }}
6867
tags: ghcr.io/psal-postech/${{ env.IMAGE_TAG}}
6968

7069
test_add:

.github/workflows/tag_release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,15 @@ jobs:
5252
echo "DUMP_PATH=/tmp/torchsim-ci/${GITHUB_SHA}"
5353
5454
- name: Build and Push Docker Image
55-
uses: docker/build-push-action@v4
56-
env:
57-
GIT_ACCESS_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
55+
uses: docker/build-push-action@v6
5856
with:
5957
context: .
6058
file: ./Dockerfile
6159
push: true
6260
build-args: |
6361
GEM5_ASSET_ID=${{ env.GEM5_ASSET_ID }}
6462
LLVM_ASSET_ID=${{ env.LLVM_ASSET_ID }}
65-
GIT_ACCESS_TOKEN=${{ env.GIT_ACCESS_TOKEN }}
6663
TORCHSIM_SHA=${{ env.GITHUB_SHA }}
64+
secrets: |
65+
GIT_ACCESS_TOKEN=${{ secrets.GIT_ACCESS_TOKEN }}
6766
tags: ghcr.io/psal-postech/${{ env.IMAGE_TAG}}

Dockerfile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# syntax=docker/dockerfile:1.4
12
# Copyright (c) 2020 The Regents of the University of California
23
# All Rights Reserved.
34
#
@@ -26,22 +27,25 @@
2627
FROM ghcr.io/psal-postech/torchsim_base:latest
2728

2829
# Pass Access Token securely
29-
ARG GIT_ACCESS_TOKEN
3030
ARG GEM5_ASSET_ID
3131
ARG LLVM_ASSET_ID
3232
ARG TORCHSIM_SHA
3333
ENV PATH $PATH:/root/.local/bin
3434
ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/opt/conda/lib:/usr/local/nvidia/lib:/usr/local/nvidia/lib64:$LD_LIBRARY_PATH
3535

3636
# Download GEM5 for torchsim
37-
RUN curl -L -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GIT_ACCESS_TOKEN}" https://api.github.com/repos/PSAL-POSTECH/gem5/releases/assets/${GEM5_ASSET_ID} -o /tmp/gem5-release.tar.gz && \
37+
RUN --mount=type=secret,id=GIT_ACCESS_TOKEN \
38+
GIT_ACCESS_TOKEN=$(cat /run/secrets/GIT_ACCESS_TOKEN) && \
39+
curl -L -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GIT_ACCESS_TOKEN}" https://api.github.com/repos/PSAL-POSTECH/gem5/releases/assets/${GEM5_ASSET_ID} -o /tmp/gem5-release.tar.gz && \
3840
mkdir -p /gem5 && \
3941
tar -xzf /tmp/gem5-release.tar.gz -C /gem5 && \
4042
rm /tmp/gem5-release.tar.gz
4143
ENV GEM5_PATH /gem5/release/gem5.opt
4244

4345
# Download LLVM RISC-V for torchsim
44-
RUN curl -L -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GIT_ACCESS_TOKEN}" https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/assets/${LLVM_ASSET_ID} -o /tmp/riscv-llvm-release.tar.gz && \
46+
RUN --mount=type=secret,id=GIT_ACCESS_TOKEN \
47+
GIT_ACCESS_TOKEN=$(cat /run/secrets/GIT_ACCESS_TOKEN) && \
48+
curl -L -H "Accept: application/octet-stream" -H "Authorization: Bearer ${GIT_ACCESS_TOKEN}" https://api.github.com/repos/PSAL-POSTECH/llvm-project/releases/assets/${LLVM_ASSET_ID} -o /tmp/riscv-llvm-release.tar.gz && \
4549
tar -xzf /tmp/riscv-llvm-release.tar.gz -C / && \
4650
rm /tmp/riscv-llvm-release.tar.gz
4751

@@ -52,16 +56,20 @@ ENV TORCHSIM_DIR /workspace/PyTorchSim
5256
ENV LLVM_DIR /riscv-llvm
5357

5458
# Install Spike simulator
55-
RUN git clone https://${GIT_ACCESS_TOKEN}@github.com/PSAL-POSTECH/riscv-isa-sim.git --branch TorchSim && cd riscv-isa-sim && mkdir build && cd build && \
59+
RUN --mount=type=secret,id=GIT_ACCESS_TOKEN \
60+
GIT_ACCESS_TOKEN=$(cat /run/secrets/GIT_ACCESS_TOKEN) && \
61+
git clone https://$GIT_ACCESS_TOKEN@github.com/PSAL-POSTECH/riscv-isa-sim.git --branch TorchSim && cd riscv-isa-sim && mkdir build && cd build && \
5662
../configure --prefix=$RISCV && make -j && make install
5763

5864
# Install Proxy kernel
5965
RUN git clone https://github.com/riscv-software-src/riscv-pk.git && \
6066
cd riscv-pk && git checkout 4f3debe4d04f56d31089c1c716a27e2d5245e9a1 && mkdir build && cd build && \
6167
../configure --prefix=$RISCV --host=riscv64-unknown-elf && make -j && make install
6268

63-
# Prepare ONNXim project
64-
RUN git clone https://${GIT_ACCESS_TOKEN}@github.com/PSAL-POSTECH/PyTorchSim.git && cd PyTorchSim && git checkout ${TORCHSIM_SHA}
69+
# Prepare PyTorchSim project
70+
RUN --mount=type=secret,id=GIT_ACCESS_TOKEN \
71+
GIT_ACCESS_TOKEN=$(cat /run/secrets/GIT_ACCESS_TOKEN) && \
72+
git clone https://$GIT_ACCESS_TOKEN@github.com/PSAL-POSTECH/PyTorchSim.git && cd PyTorchSim && git checkout ${TORCHSIM_SHA}
6573
RUN cd PyTorchSim/PyTorchSimBackend && \
6674
git submodule update --recursive --init && \
6775
mkdir -p build && \

0 commit comments

Comments
 (0)