|
6 | 6 |
|
7 | 7 | env: |
8 | 8 | PROJECT_ID: ${{ secrets.GKE_PROD_PROJECT }} |
9 | | -# ` `` GKE_ZONE: us-central1-c # TODO: update to cluster zone |
10 | | - RELEASE_VER : ${{ github.event.release.tag_name }} |
11 | | -jobs: |
| 9 | + # ` `` GKE_ZONE: us-central1-c # TODO: update to cluster zone |
| 10 | + RELEASE_VER: ${{ github.event.release.tag_name }} |
12 | 11 |
|
| 12 | +jobs: |
13 | 13 | setup-build-publish-deploy: |
14 | 14 | name: Build images |
15 | 15 | runs-on: ubuntu-latest |
16 | 16 |
|
| 17 | + permissions: |
| 18 | + contents: read |
| 19 | + packages: write |
| 20 | + id-token: write |
| 21 | + |
17 | 22 | steps: |
18 | | - - name: Checkout |
19 | | - uses: actions/checkout@v2 |
20 | | - |
21 | | - - name: Get release version |
22 | | - run: echo "$RELEASE_VER" |
23 | | - |
24 | | - - uses: google-github-actions/setup-gcloud@v0.2.0 |
25 | | - with: |
26 | | - service_account_key: ${{ secrets.GKE_PROD_SA_KEY }} |
27 | | - project_id: ${{ secrets.GKE_PROD_PROJECT }} |
28 | | - export_default_credentials: true |
29 | | - |
30 | | - # Configure Docker to use the gcloud command-line tool as a credential helper for authentication |
31 | | - - run: |- |
32 | | - gcloud auth configure-docker us-central1-docker.pkg.dev |
33 | | -
|
34 | | - - run: |- |
35 | | - gcloud config get-value project |
36 | | -
|
37 | | - - run: |- |
38 | | - curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 |
39 | | - chmod a+x skaffold |
40 | | -
|
41 | | - - name: Update package version |
42 | | - run: | |
43 | | - sed -i 's/0.0.0/${{env.RELEASE_VER}}/g' src/robusta/_version.py helm/robusta/Chart.yaml helm/robusta/values.yaml |
44 | | - sed -i 's/version = "0.0.0"/version = "${{env.RELEASE_VER}}"/g' pyproject.toml |
45 | | - sed -i 's/0.0.1/${{env.RELEASE_VER}}/g' helm/robusta/Chart.yaml |
46 | | -
|
47 | | - # Set up the buildx to run build for multiple platforms |
48 | | - - name: Set up QEMU |
49 | | - uses: docker/setup-qemu-action@c5ffa2a61740d9877bd1f40899a87c8ec93b0d9f |
50 | | - |
51 | | - - name: Docker Setup Buildx |
52 | | - uses: docker/setup-buildx-action@bea6a01aa40b4d58b0382d47e1c4a70137af67b1 |
53 | | - with: |
54 | | - config-inline: | |
55 | | - [worker.oci] |
56 | | - enabled = true |
57 | | - platforms = [ "linux/amd64", "linux/arm64" ] |
58 | | -
|
59 | | - # see https://github.com/GoogleContainerTools/skaffold/issues/4842 |
60 | | - - name: Cache skaffold image builds & config |
61 | | - uses: actions/cache@v2 |
62 | | - with: |
63 | | - path: ~/.skaffold/ |
64 | | - key: fixed-${{ github.sha }} |
65 | | - restore-keys: | |
66 | | - fixed-${{ github.sha }} |
67 | | - fixed- |
68 | | -
|
69 | | - - name: Login to Docker Hub |
70 | | - uses: docker/login-action@v1 |
71 | | - with: |
72 | | - username: ${{ secrets.DOCKER_USERNAME }} |
73 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
74 | | - |
75 | | - - name: Build with skaffold |
76 | | - run: ./skaffold build --profile release --file-output=container-ids.json --tag='${{env.RELEASE_VER}}' |
77 | | - |
78 | | - |
79 | | - - name: Save artifact with tags of built containers |
80 | | - uses: actions/upload-artifact@v4 |
81 | | - with: |
82 | | - name: container-ids |
83 | | - path: container-ids.json |
84 | | - |
85 | | - - name: Set up Python |
86 | | - uses: actions/setup-python@v2 |
87 | | - with: |
88 | | - python-version: 3.9 |
89 | | - |
90 | | - - name: Install dependencies |
91 | | - run: | |
92 | | - python -m pip install --upgrade pip |
93 | | - pip install twine |
94 | | -
|
95 | | - - name: Prepare pypi dist |
96 | | - run: | |
97 | | - curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 |
98 | | - poetry config virtualenvs.create false |
99 | | - poetry install --extras "all" |
100 | | - poetry publish --build -u __token__ -p ${{ secrets.PYPI_PROJECT_TOKEN }} |
101 | | -
|
102 | | - - name: Save artifact with helm chart |
103 | | - uses: actions/upload-artifact@v4 |
104 | | - with: |
105 | | - name: helm-chart |
106 | | - path: helm/robusta/ |
107 | | - |
108 | | - - name: Release Docker to Dockerhub |
109 | | - run: |- |
110 | | - docker buildx build \ |
111 | | - --build-arg BUILDKIT_INLINE_CACHE=1 \ |
112 | | - --platform linux/arm64,linux/amd64 \ |
113 | | - --cache-from us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta:cache \ |
114 | | - --tag robustadev/robusta-runner:${{env.RELEASE_VER}} \ |
115 | | - --push \ |
116 | | - . |
117 | | -
|
118 | | - - name: Upload helm chart |
119 | | - run: | |
120 | | - cd helm && ./upload_chart.sh |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Get release version |
| 27 | + run: echo "$RELEASE_VER" |
| 28 | + |
| 29 | + - uses: google-github-actions/auth@v2 |
| 30 | + with: |
| 31 | + project_id: ${{ secrets.GKE_PROD_PROJECT }} |
| 32 | + workload_identity_provider: 'projects/429189597230/locations/global/workloadIdentityPools/github/providers/robusta-repos' # prod |
| 33 | + |
| 34 | + - name: Set up gcloud CLI |
| 35 | + uses: google-github-actions/setup-gcloud@v2 |
| 36 | + with: |
| 37 | + project_id: ${{ secrets.GKE_PROD_PROJECT }} |
| 38 | + |
| 39 | + - name: Configure Docker Registry |
| 40 | + run: gcloud auth configure-docker us-central1-docker.pkg.dev |
| 41 | + |
| 42 | + |
| 43 | + - run: |- |
| 44 | + curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 |
| 45 | + chmod a+x skaffold |
| 46 | +
|
| 47 | + - name: Update package version |
| 48 | + run: | |
| 49 | + sed -i 's/0.0.0/${{env.RELEASE_VER}}/g' src/robusta/_version.py helm/robusta/Chart.yaml helm/robusta/values.yaml |
| 50 | + sed -i 's/version = "0.0.0"/version = "${{env.RELEASE_VER}}"/g' pyproject.toml |
| 51 | + sed -i 's/0.0.1/${{env.RELEASE_VER}}/g' helm/robusta/Chart.yaml |
| 52 | +
|
| 53 | + # Set up the buildx to run build for multiple platforms |
| 54 | + - name: Set up QEMU |
| 55 | + uses: docker/setup-qemu-action@c5ffa2a61740d9877bd1f40899a87c8ec93b0d9f |
| 56 | + |
| 57 | + - name: Docker Setup Buildx |
| 58 | + uses: docker/setup-buildx-action@bea6a01aa40b4d58b0382d47e1c4a70137af67b1 |
| 59 | + with: |
| 60 | + config-inline: | |
| 61 | + [worker.oci] |
| 62 | + enabled = true |
| 63 | + platforms = [ "linux/amd64", "linux/arm64" ] |
| 64 | +
|
| 65 | + # see https://github.com/GoogleContainerTools/skaffold/issues/4842 |
| 66 | + - name: Cache skaffold image builds & config |
| 67 | + uses: actions/cache@v4 |
| 68 | + with: |
| 69 | + path: ~/.skaffold/ |
| 70 | + key: fixed-${{ github.sha }} |
| 71 | + restore-keys: | |
| 72 | + fixed-${{ github.sha }} |
| 73 | + fixed- |
| 74 | +
|
| 75 | + - name: Login to Docker Hub |
| 76 | + uses: docker/login-action@v1 |
| 77 | + with: |
| 78 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 79 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 80 | + |
| 81 | + - name: Build with skaffold |
| 82 | + run: ./skaffold build --profile release --file-output=container-ids.json --tag='${{env.RELEASE_VER}}' |
| 83 | + |
| 84 | + - name: Save artifact with tags of built containers |
| 85 | + uses: actions/upload-artifact@v4 |
| 86 | + with: |
| 87 | + name: container-ids |
| 88 | + path: container-ids.json |
| 89 | + |
| 90 | + - name: Set up Python |
| 91 | + uses: actions/setup-python@v2 |
| 92 | + with: |
| 93 | + python-version: 3.9 |
| 94 | + |
| 95 | + - name: Install dependencies |
| 96 | + run: | |
| 97 | + python -m pip install --upgrade pip |
| 98 | + pip install twine |
| 99 | +
|
| 100 | + - name: Prepare pypi dist |
| 101 | + run: | |
| 102 | + curl -sSL https://install.python-poetry.org | python3 - --version 1.4.0 |
| 103 | + poetry config virtualenvs.create false |
| 104 | + poetry install --extras "all" |
| 105 | + poetry publish --build -u __token__ -p ${{ secrets.PYPI_PROJECT_TOKEN }} |
| 106 | +
|
| 107 | + - name: Save artifact with helm chart |
| 108 | + uses: actions/upload-artifact@v4 |
| 109 | + with: |
| 110 | + name: helm-chart |
| 111 | + path: helm/robusta/ |
| 112 | + |
| 113 | + - name: Release Docker to Dockerhub |
| 114 | + run: |- |
| 115 | + docker buildx build \ |
| 116 | + --build-arg BUILDKIT_INLINE_CACHE=1 \ |
| 117 | + --platform linux/arm64,linux/amd64 \ |
| 118 | + --cache-from us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta:cache \ |
| 119 | + --tag robustadev/robusta-runner:${{env.RELEASE_VER}} \ |
| 120 | + --push \ |
| 121 | + . |
| 122 | +
|
| 123 | + - name: Upload helm chart |
| 124 | + run: | |
| 125 | + cd helm && ./upload_chart.sh |
0 commit comments