|
62 | 62 | github.event.inputs.target_device == 'tpu' || |
63 | 63 | github.event.inputs.target_device == 'gpu' |
64 | 64 | ) |
| 65 | + outputs: |
| 66 | + should_run: ${{ steps.check.outputs.should_run }} # Map the step output to the job level |
65 | 67 | steps: |
66 | 68 | - name: Check if build should run |
67 | 69 | id: check |
@@ -121,28 +123,80 @@ jobs: |
121 | 123 | LIBTPU_VERSION=NONE |
122 | 124 | INCLUDE_TEST_ASSETS=true |
123 | 125 |
|
| 126 | + test: |
| 127 | + needs: build_and_push |
| 128 | + if: | |
| 129 | + needs.build_and_push.result == 'success' && |
| 130 | + needs.build_and_push.outputs.should_run == 'true' |
| 131 | + strategy: |
| 132 | + fail-fast: false |
| 133 | + matrix: |
| 134 | + flavor: >- |
| 135 | + ${{ fromJSON('{ |
| 136 | + "gpu-pre-training": ["gpu-unit", "gpu-integration"], |
| 137 | + "tpu-post-training": ["post-training-tpu-unit", "post-training-tpu-integration", "post-training-cpu-unit"], |
| 138 | + "tpu-pre-training": ["tpu-unit", "tpu-integration", "cpu-unit"] |
| 139 | + }')[format('{0}-{1}', inputs.device, inputs.workflow)] }} |
| 140 | + uses: ./.github/workflows/run_tests_coordinator.yml |
| 141 | + with: |
| 142 | + flavor: ${{ matrix.flavor }} |
| 143 | + base_image: ${{ inputs.image_name }}:${{ github.run_id }} |
| 144 | + is_scheduled_run: true |
| 145 | + maxtext_installed: true |
| 146 | + |
| 147 | + notebook-test: |
| 148 | + needs: build_and_push |
| 149 | + if: | |
| 150 | + inputs.device == 'tpu' && |
| 151 | + inputs.workflow = 'post-training' && |
| 152 | + needs.build_and_push.result == 'success' && |
| 153 | + needs.build_and_push.outputs.should_run == 'true' |
| 154 | + uses: ./.github/workflows/run_jupyter_notebooks.yml |
| 155 | + with: |
| 156 | + device_type: tpu |
| 157 | + device_name: v6e-4 |
| 158 | + base_image: ${{ inputs.image_name }}:${{ github.run_id }} |
| 159 | + cloud_runner: linux-x86-ct6e-180-4tpu |
| 160 | + maxtext_installed: true |
| 161 | + secrets: |
| 162 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 163 | + |
| 164 | + tagging: |
| 165 | + needs: [test, notebook-test] |
| 166 | + if: | |
| 167 | + always() && |
| 168 | + needs.test.result == 'success' && |
| 169 | + (needs.notebook-test.result == 'success' || needs.notebook-test.result == 'skipped') |
| 170 | + runs-on: linux-x86-n2-16-buildkit |
| 171 | + container: google/cloud-sdk:524.0.0 |
| 172 | + steps: |
| 173 | + - name: Configure Docker |
| 174 | + run: gcloud auth configure-docker us-docker.pkg.dev,gcr.io -q |
| 175 | + |
124 | 176 | - name: Add tags to Docker image |
125 | | - if: steps.check.outputs.should_run == 'true' |
126 | 177 | shell: bash |
127 | 178 | run: | |
128 | 179 | SOURCE_IMAGE="gcr.io/tpu-prod-env-multipod/${INPUTS_IMAGE_NAME}" |
| 180 | + TEMP_IMG="${SOURCE_IMAGE}:${{ github.run_id }}" |
129 | 181 |
|
130 | 182 | if [[ $INPUTS_VERSION_NAME ]]; then |
131 | 183 | echo "Tagging docker images corresponding to PyPI release..." |
132 | | - gcloud container images add-tag "$SOURCE_IMAGE:${{ github.run_id }}" "$SOURCE_IMAGE:${INPUTS_VERSION_NAME}" --quiet |
| 184 | + gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:${INPUTS_VERSION_NAME}" --quiet |
133 | 185 | else |
134 | 186 | echo "Tagging docker images corresponding to nightly release..." |
135 | 187 |
|
136 | 188 | # Add date tag |
137 | | - gcloud container images add-tag "$SOURCE_IMAGE:${{ github.run_id }}" "$SOURCE_IMAGE:${INPUTS_IMAGE_DATE}" --quiet |
| 189 | + gcloud container images add-tag "${TEMP_IMG}" "$SOURCE_IMAGE:${INPUTS_IMAGE_DATE}" --quiet |
138 | 190 |
|
139 | 191 | # Convert date to YYYYMMDD format |
140 | 192 | clean_date=$(echo "${INPUTS_IMAGE_DATE}" | sed 's/[-:]//g' | cut -c1-8) |
141 | 193 |
|
142 | 194 | # Add MaxText tag |
143 | 195 | maxtext_hash=$(git rev-parse --short HEAD) |
144 | | - gcloud container images add-tag "$SOURCE_IMAGE:${{ github.run_id }}" "$SOURCE_IMAGE:maxtext_${maxtext_hash}_${clean_date}" --quiet |
145 | | - fi |
| 196 | + gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:maxtext_${maxtext_hash}_${clean_date}" --quiet |
| 197 | +
|
| 198 | + # Latest Tag |
| 199 | + gcloud container images add-tag "${TEMP_IMG}" "${SOURCE_IMAGE}:latest" --quiet |
146 | 200 | env: |
147 | 201 | INPUTS_IMAGE_NAME: ${{ inputs.image_name }} |
148 | 202 | INPUTS_IMAGE_DATE: ${{ inputs.image_date }} |
|
0 commit comments