|
23 | 23 | type: string |
24 | 24 |
|
25 | 25 | jobs: |
26 | | - steps: |
27 | | - - name: Checkout |
28 | | - uses: actions/checkout@v4 |
| 26 | + docker-build: |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
29 | 30 |
|
30 | | - - name: Setup python |
31 | | - uses: actions/setup-python@v5 |
32 | | - with: |
33 | | - python-version: 3.12 |
| 31 | + - name: Setup python |
| 32 | + uses: actions/setup-python@v5 |
| 33 | + with: |
| 34 | + python-version: 3.12 |
34 | 35 |
|
35 | | - - name: Get PR info |
36 | | - id: get-pr-info |
37 | | - if: startsWith(github.ref, 'refs/heads/pull-request/') |
38 | | - uses: nv-gha-runners/get-pr-info@main |
| 36 | + - name: Get PR info |
| 37 | + id: get-pr-info |
| 38 | + if: startsWith(github.ref, 'refs/heads/pull-request/') |
| 39 | + uses: nv-gha-runners/get-pr-info@main |
39 | 40 |
|
40 | | - - name: Install Azure CLI |
41 | | - shell: bash |
42 | | - run: | |
43 | | - echo "::group::Install Azure CLI" |
44 | | - # Create systemd override for proper dependencies |
45 | | - curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash |
46 | | - echo "::endgroup::" |
| 41 | + - name: Install Azure CLI |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + echo "::group::Install Azure CLI" |
| 45 | + # Create systemd override for proper dependencies |
| 46 | + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash |
| 47 | + echo "::endgroup::" |
47 | 48 |
|
48 | | - - name: Azure Login |
49 | | - uses: azure/login@v2 |
50 | | - with: |
51 | | - client-id: ${{ secrets.AZURE_CLIENT_ID }} |
52 | | - tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
53 | | - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 49 | + - name: Azure Login |
| 50 | + uses: azure/login@v2 |
| 51 | + with: |
| 52 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 53 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 54 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
54 | 55 |
|
55 | | - - name: Azure ACR Login |
56 | | - shell: bash |
57 | | - run: | |
58 | | - az acr login --name nemoci |
| 56 | + - name: Azure ACR Login |
| 57 | + shell: bash |
| 58 | + run: | |
| 59 | + az acr login --name nemoci |
59 | 60 |
|
60 | | - - name: Install GH CLI |
61 | | - shell: bash |
62 | | - run: | |
63 | | - apt-get update |
64 | | - apt-get install -y gh |
| 61 | + - name: Install GH CLI |
| 62 | + shell: bash |
| 63 | + run: | |
| 64 | + apt-get update |
| 65 | + apt-get install -y gh |
65 | 66 |
|
66 | | - - name: Get last merged PR |
67 | | - id: cache_from |
68 | | - env: |
69 | | - GH_TOKEN: ${{ github.token }} |
70 | | - REPO_NAME: ${{ inputs.repo_name }} |
71 | | - run: | |
72 | | - LAST_PRS=$(gh api graphql -f query=' |
73 | | - query { |
74 | | - repository(owner: "NVIDIA-NeMo", name: "$REPO_NAME") { |
75 | | - pullRequests(states: MERGED, first: 100, orderBy: {field: UPDATED_AT, direction: DESC}) { |
76 | | - nodes { |
77 | | - number |
| 67 | + - name: Get last merged PR |
| 68 | + id: cache_from |
| 69 | + env: |
| 70 | + GH_TOKEN: ${{ github.token }} |
| 71 | + REPO_NAME: ${{ inputs.repo_name }} |
| 72 | + run: | |
| 73 | + LAST_PRS=$(gh api graphql -f query=' |
| 74 | + query { |
| 75 | + repository(owner: "NVIDIA-NeMo", name: "$REPO_NAME") { |
| 76 | + pullRequests(states: MERGED, first: 100, orderBy: {field: UPDATED_AT, direction: DESC}) { |
| 77 | + nodes { |
| 78 | + number |
| 79 | + } |
78 | 80 | } |
79 | 81 | } |
80 | | - } |
81 | | - }' | jq -r '.data.repository.pullRequests.nodes[].number' | while read -r number; do |
82 | | - echo "type=registry,ref=${{ env.container-registry }}/$REPO_NAME:$number-buildcache,mode=max" |
83 | | - done) |
| 82 | + }' | jq -r '.data.repository.pullRequests.nodes[].number' | while read -r number; do |
| 83 | + echo "type=registry,ref=${{ env.container-registry }}/$REPO_NAME:$number-buildcache,mode=max" |
| 84 | + done) |
84 | 85 |
|
85 | | - echo "LAST_PRS<<EOF" | tee -a $GITHUB_OUTPUT |
86 | | - echo "$LAST_PRS" | tee -a $GITHUB_OUTPUT |
87 | | - echo "EOF" | tee -a $GITHUB_OUTPUT |
| 86 | + echo "LAST_PRS<<EOF" | tee -a $GITHUB_OUTPUT |
| 87 | + echo "$LAST_PRS" | tee -a $GITHUB_OUTPUT |
| 88 | + echo "EOF" | tee -a $GITHUB_OUTPUT |
88 | 89 |
|
89 | | - - name: Set up Docker Buildx |
90 | | - uses: docker/setup-buildx-action@v3 |
| 90 | + - name: Set up Docker Buildx |
| 91 | + uses: docker/setup-buildx-action@v3 |
91 | 92 |
|
92 | | - - name: Build and push |
93 | | - uses: docker/build-push-action@v5 |
94 | | - env: |
95 | | - REPO_NAME: ${{ inputs.repo_name }} |
96 | | - with: |
97 | | - file: ./docker/Dockerfile.ci |
98 | | - push: true |
99 | | - context: . |
100 | | - build-args: | |
101 | | - BASE_IMAGE=pytorch |
102 | | - cache-from: | |
103 | | - type=registry,ref=${{ env.container-registry }}/$REPO_NAME:${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number || 0 }}-buildcache,mode=max |
104 | | - type=registry,ref=${{ env.container-registry }}/$REPO_NAME:main-buildcache,mode=max |
105 | | - ${{ steps.cache_from.outputs.LAST_PRS }} |
106 | | - cache-to: | |
107 | | - type=registry,ref=${{ env.container-registry }}/$REPO_NAME:${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number || 0 }}-buildcache,mode=max |
108 | | - no-cache: false |
109 | | - tags: | |
110 | | - ${{ env.container-registry }}/$REPO_NAME:${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number || 0 }} |
111 | | - ${{ env.container-registry }}/$REPO_NAME:${{ github.sha }} |
112 | | - secrets: | |
113 | | - GH_TOKEN=${{ secrets.PAT }} |
| 93 | + - name: Build and push |
| 94 | + uses: docker/build-push-action@v5 |
| 95 | + env: |
| 96 | + REPO_NAME: ${{ inputs.repo_name }} |
| 97 | + with: |
| 98 | + file: ./docker/Dockerfile.ci |
| 99 | + push: true |
| 100 | + context: . |
| 101 | + build-args: | |
| 102 | + BASE_IMAGE=pytorch |
| 103 | + cache-from: | |
| 104 | + type=registry,ref=${{ env.container-registry }}/$REPO_NAME:${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number || 0 }}-buildcache,mode=max |
| 105 | + type=registry,ref=${{ env.container-registry }}/$REPO_NAME:main-buildcache,mode=max |
| 106 | + ${{ steps.cache_from.outputs.LAST_PRS }} |
| 107 | + cache-to: | |
| 108 | + type=registry,ref=${{ env.container-registry }}/$REPO_NAME:${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number || 0 }}-buildcache,mode=max |
| 109 | + no-cache: false |
| 110 | + tags: | |
| 111 | + ${{ env.container-registry }}/$REPO_NAME:${{ fromJSON(steps.get-pr-info.outputs.pr-info || '{}').number || 0 }} |
| 112 | + ${{ env.container-registry }}/$REPO_NAME:${{ github.sha }} |
| 113 | + secrets: | |
| 114 | + GH_TOKEN=${{ secrets.PAT }} |
0 commit comments