-
Notifications
You must be signed in to change notification settings - Fork 391
129 lines (119 loc) · 5.17 KB
/
pipeline.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CI Pipeline
on:
workflow_call:
jobs:
docker-tag:
name: Check if 'latest' tag could be used (no build docker images)
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- run: |
sudo apt update -qq
sudo apt install -y git curl jq sudo ca-certificates
sudo update-ca-certificates
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-tag
id: tag
with:
dockerfile: Jenkins/fast-release/Dockerfile.ci
variants:
name: Define supported AIMET variants
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.final.outputs.value }}
steps:
- run: |
sudo apt update -qq
sudo apt install -y git curl jq sudo ca-certificates
sudo update-ca-certificates
- name: Torch variants
run: |
set -x
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{ "VER_PYTHON":"3.10", "VER_TENSORFLOW":"", "VER_TORCH":"2.1.2", "VER_ONNX":"", "VER_CUDA":"" },
{ "VER_PYTHON":"3.10", "VER_TENSORFLOW":"", "VER_TORCH":"2.1.2", "VER_ONNX":"", "VER_CUDA":"11.8.0" }
]')
echo "VALUE=$VALUE" >> $GITHUB_ENV
- name: Tensorflow variants
run: |
set -x
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{ "VER_PYTHON":"3.10", "VER_TENSORFLOW":"2.10.1", "VER_TORCH":"", "VER_ONNX":"", "VER_CUDA":"" },
{ "VER_PYTHON":"3.10", "VER_TENSORFLOW":"2.10.1", "VER_TORCH":"", "VER_ONNX":"", "VER_CUDA":"11.8.0" }
]')
echo "VALUE=$VALUE" >> $GITHUB_ENV
- name: ONNX variants
run: |
set -x
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{ "VER_PYTHON":"3.10", "VER_TENSORFLOW":"", "VER_TORCH":"1.13.1", "VER_ONNX":"1.14.1", "VER_CUDA":"" },
{ "VER_PYTHON":"3.10", "VER_TENSORFLOW":"", "VER_TORCH":"1.13.1", "VER_ONNX":"1.14.1", "VER_CUDA":"11.7.1" }
]')
echo "VALUE=$VALUE" >> $GITHUB_ENV
- name: (Last step) Generate few extra properties for each variant
id: final
run: |
set -x
VALUE=$(echo "$VALUE" | jq -c '.include[] |= . + {
"runs-on":(if .VER_CUDA != "" then "k8s-gpu" else "ubuntu-latest" end),
"id":(""
+(if .VER_TENSORFLOW != "" then "tf-" else "" end)
+(if .VER_ONNX != "" then "onnx-" elif .VER_TORCH != "" then "torch-" else "" end)
+(if .VER_CUDA != "" then "gpu" else "cpu" end)
)
}')
echo "value=$VALUE" >> $GITHUB_OUTPUT
docker-build-image:
name: Docker image ${{ matrix.id }}
runs-on: ubuntu-latest
needs: [docker-tag, variants]
strategy:
matrix: ${{ fromJSON(needs.variants.outputs.matrix) }}
steps:
- run: |
sudo apt update -qq
sudo apt install -y git curl jq sudo ca-certificates
sudo update-ca-certificates
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build-image
with:
dockerfile: Jenkins/fast-release/Dockerfile.ci
docker-login: ${{ secrets.DOCKER_LOGIN }}
docker-password: ${{ secrets.DOCKER_CREDENTIALS }}
docker-registry: ${{ vars.DOCKER_REGISTRY }}
image-name: "${{ vars.DOCKER_IMAGE }}-${{ matrix.id }}"
image-tag: ${{ needs.docker-tag.outputs.tag }}
build-args: |
VER_PYTHON=${{ matrix.VER_PYTHON }}
VER_CUDA=${{ matrix.VER_CUDA }}
VER_TORCH=${{ matrix.VER_TORCH }}
VER_TENSORFLOW=${{ matrix.VER_TENSORFLOW }}
VER_ONNX=${{ matrix.VER_ONNX }}
docker-push-latest:
needs: [docker-tag, variants, docker-build-image]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.variants.outputs.matrix) }}
steps:
- run: sudo sh -c "cp /tmp/certs/* /usr/local/share/ca-certificates/ && update-ca-certificates"
- uses: docker/setup-buildx-action@v3
with:
driver: docker
- uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_CREDENTIALS }}
- name: Create the 'latest' docker image tag
if: ${{ github.ref_name == github.event.repository.default_branch && needs.docker-tag.outputs.tag != 'latest' }}
run: docker buildx imagetools create ${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_IMAGE }}-${{ matrix.id }}:${{ needs.docker-tag.outputs.tag }} --tag ${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_IMAGE }}-${{ matrix.id }}:latest
cleanup:
needs: [docker-tag, variants, docker-push-latest]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.variants.outputs.matrix) }}
steps:
- name: Delete temp docker image
if: needs.docker-tag.outputs.tag != 'latest'
run: curl -k -H "Authorization:Bearer ${{ secrets.DOCKER_CREDENTIALS }}" -X DELETE "https://${{ vars.DOCKER_REGISTRY }}/v2/${{ vars.DOCKER_IMAGE }}-${{ matrix.id }}/manifests/${{ needs.docker-tag.outputs.tag }}" || true