1818 - main
1919 - master
2020 - develop
21+ schedule :
22+ # Run weekly on Mondays at 2 AM UTC
23+ - cron : ' 0 2 * * 1'
2124 workflow_dispatch :
2225 inputs :
2326 push_images :
7275 type=semver,pattern={{version}}
7376 type=semver,pattern={{major}}.{{minor}}
7477 type=raw,value=latest,enable={{is_default_branch}}
75- type=raw,value=daily ,enable={{is_default_branch}}
78+ type=raw,value=weekly ,enable={{is_default_branch}}
7679 type=sha,prefix={{branch}}-
7780
7881 - name : Build and push Ubuntu image
@@ -91,162 +94,159 @@ jobs:
9194 VCS_REF=${{ github.sha }}
9295 VERSION=${{ steps.meta.outputs.version }}
9396
94- # TEMPORARILY DISABLED FOR TESTING
95- # build-slim:
96- # name: Build Slim Image
97- # runs-on: ubuntu-latest
98- # permissions:
99- # contents: read
100- # packages: write
101- #
102- # steps:
103- # - name: Checkout repository
104- # uses: actions/checkout@v4
105- #
106- # - name: Set up QEMU
107- # uses: docker/setup-qemu-action@v3
108- #
109- # - name: Set up Docker Buildx
110- # uses: docker/setup-buildx-action@v3
111- #
112- # - name: Log in to Nexus Registry
113- # if: github.event_name != 'pull_request'
114- # uses: docker/login-action@v3
115- # with:
116- # registry: ${{ env.REGISTRY }}
117- # username: ${{ secrets.NEXUS_USERNAME }}
118- # password: ${{ secrets.NEXUS_PASSWORD }}
119- #
120- # - name: Extract metadata
121- # id: meta
122- # uses: docker/metadata-action@v5
123- # with:
124- # images: |
125- # ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
126- # tags: |
127- # type=ref,event=branch,suffix=-slim
128- # type=ref,event=pr,suffix=-slim
129- # type=semver,pattern={{version}},suffix=-slim
130- # type=semver,pattern={{major}}.{{minor}},suffix=-slim
131- # type=raw,value=latest-slim,enable={{is_default_branch}}
132- # type=raw,value=daily-slim,enable={{is_default_branch}}
133- # type=sha,prefix={{branch}}-,suffix=-slim
134- #
135- # - name: Build and push Slim image
136- # uses: docker/build-push-action@v5
137- # with:
138- # context: .
139- # file: ./Dockerfile.slim
140- # platforms: linux/amd64
141- # push: ${{ github.event_name != 'pull_request' }}
142- # tags: ${{ steps.meta.outputs.tags }}
143- # labels: ${{ steps.meta.outputs.labels }}
144- # cache-from: type=gha
145- # cache-to: type=gha,mode=max
146- # build-args: |
147- # BUILD_DATE=${{ github.event.head_commit.timestamp }}
148- # VCS_REF=${{ github.sha }}
149- # VERSION=${{ steps.meta.outputs.version }}
97+ build-slim :
98+ name : Build Slim Image
99+ runs-on : ubuntu-latest
100+ permissions :
101+ contents : read
102+ packages : write
103+
104+ steps :
105+ - name : Checkout repository
106+ uses : actions/checkout@v4
107+
108+ - name : Set up QEMU
109+ uses : docker/setup-qemu-action@v3
110+
111+ - name : Set up Docker Buildx
112+ uses : docker/setup-buildx-action@v3
113+
114+ - name : Log in to Nexus Registry
115+ if : github.event_name != 'pull_request'
116+ uses : docker/login-action@v3
117+ with :
118+ registry : ${{ env.REGISTRY }}
119+ username : ${{ secrets.NEXUS_USERNAME }}
120+ password : ${{ secrets.NEXUS_PASSWORD }}
121+
122+ - name : Extract metadata
123+ id : meta
124+ uses : docker/metadata-action@v5
125+ with :
126+ images : |
127+ ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
128+ tags : |
129+ type=ref,event=branch,suffix=-slim
130+ type=ref,event=pr,suffix=-slim
131+ type=semver,pattern={{version}},suffix=-slim
132+ type=semver,pattern={{major}}.{{minor}},suffix=-slim
133+ type=raw,value=latest-slim,enable={{is_default_branch}}
134+ type=raw,value=weekly-slim,enable={{is_default_branch}}
135+ type=sha,prefix={{branch}}-,suffix=-slim
136+
137+ - name : Build and push Slim image
138+ uses : docker/build-push-action@v5
139+ with :
140+ context : .
141+ file : ./Dockerfile.slim
142+ platforms : linux/amd64
143+ push : ${{ github.event_name != 'pull_request' }}
144+ tags : ${{ steps.meta.outputs.tags }}
145+ labels : ${{ steps.meta.outputs.labels }}
146+ cache-from : type=gha
147+ cache-to : type=gha,mode=max
148+ build-args : |
149+ BUILD_DATE=${{ github.event.head_commit.timestamp }}
150+ VCS_REF=${{ github.sha }}
151+ VERSION=${{ steps.meta.outputs.version }}
150152
151- # TEMPORARILY DISABLED FOR TESTING
152- # test-images:
153- # name: Test Docker Images
154- # needs: [build-ubuntu]
155- # runs-on: ubuntu-latest
156- # if: github.event_name == 'pull_request'
157- #
158- # steps:
159- # - name: Checkout repository
160- # uses: actions/checkout@v4
161- #
162- # - name: Set up Docker Buildx
163- # uses: docker/setup-buildx-action@v3
164- #
165- # - name: Build test image (Ubuntu)
166- # uses: docker/build-push-action@v5
167- # with:
168- # context: .
169- # file: ./Dockerfile
170- # load: true
171- # tags: openspp:test-ubuntu
172- # cache-from: type=gha
173- #
174- # - name: Build test image (Slim)
175- # uses: docker/build-push-action@v5
176- # with:
177- # context: .
178- # file: ./Dockerfile.slim
179- # load: true
180- # tags: openspp:test-slim
181- # cache-from: type=gha
182- #
183- # - name: Test Ubuntu image
184- # run: |
185- # echo "Testing Ubuntu image..."
186- # docker run --rm openspp:test-ubuntu openspp-server --version
187- # docker run --rm openspp:test-ubuntu openspp-server --help | grep -q "OpenSPP"
188- #
189- # - name: Test Slim image
190- # run: |
191- # echo "Testing Slim image..."
192- # docker run --rm openspp:test-slim openspp-server --version
193- # docker run --rm openspp:test-slim openspp-server --help | grep -q "OpenSPP"
194- #
195- # - name: Test health endpoint
196- # run: |
197- # echo "Starting container for health check..."
198- # docker run -d --name openspp-test -p 8069:8069 openspp:test-ubuntu
199- # sleep 60
200- # curl -f http://localhost:8069/web/health || (docker logs openspp-test && exit 1)
201- # docker stop openspp-test
202- # docker rm openspp-test
153+ test-images :
154+ name : Test Docker Images
155+ needs : [build-ubuntu, build-slim]
156+ runs-on : ubuntu-latest
157+ if : github.event_name == 'pull_request'
158+
159+ steps :
160+ - name : Checkout repository
161+ uses : actions/checkout@v4
162+
163+ - name : Set up Docker Buildx
164+ uses : docker/setup-buildx-action@v3
165+
166+ - name : Build test image (Ubuntu)
167+ uses : docker/build-push-action@v5
168+ with :
169+ context : .
170+ file : ./Dockerfile
171+ load : true
172+ tags : openspp:test-ubuntu
173+ cache-from : type=gha
174+
175+ - name : Build test image (Slim)
176+ uses : docker/build-push-action@v5
177+ with :
178+ context : .
179+ file : ./Dockerfile.slim
180+ load : true
181+ tags : openspp:test-slim
182+ cache-from : type=gha
183+
184+ - name : Test Ubuntu image
185+ run : |
186+ echo "Testing Ubuntu image..."
187+ docker run --rm openspp:test-ubuntu openspp-server --version
188+ docker run --rm openspp:test-ubuntu openspp-server --help | grep -q "OpenSPP"
189+
190+ - name : Test Slim image
191+ run : |
192+ echo "Testing Slim image..."
193+ docker run --rm openspp:test-slim openspp-server --version
194+ docker run --rm openspp:test-slim openspp-server --help | grep -q "OpenSPP"
195+
196+ - name : Test health endpoint
197+ run : |
198+ echo "Starting container for health check..."
199+ docker run -d --name openspp-test -p 8069:8069 openspp:test-ubuntu
200+ sleep 60
201+ curl -f http://localhost:8069/web/health || (docker logs openspp-test && exit 1)
202+ docker stop openspp-test
203+ docker rm openspp-test
203204
204- # TEMPORARILY DISABLED FOR TESTING
205- # update-manifests:
206- # name: Update Kubernetes Manifests
207- # needs: [build-ubuntu]
208- # runs-on: ubuntu-latest
209- # if: startsWith(github.ref, 'refs/tags/')
205+ update-manifests :
206+ name : Update Kubernetes Manifests
207+ needs : [build-ubuntu, build-slim]
208+ runs-on : ubuntu-latest
209+ if : startsWith(github.ref, 'refs/tags/')
210210
211- # steps:
212- # - name: Checkout repository
213- # uses: actions/checkout@v4
214-
215- # - name: Update deployment manifests
216- # run: |
217- # TAG=${GITHUB_REF#refs/tags/}
218- # echo "Updating manifests for tag: $TAG"
211+ steps :
212+ - name : Checkout repository
213+ uses : actions/checkout@v4
214+
215+ - name : Update deployment manifests
216+ run : |
217+ TAG=${GITHUB_REF#refs/tags/}
218+ echo "Updating manifests for tag: $TAG"
219219
220- # # Update image tags in deployment files
221- # find deployments -name "*.yaml" -type f -exec \
222- # sed -i "s|image: .*openspp:.*|image: ${{ env.PUBLIC_REGISTRY }}/${{ env.IMAGE_NAME }}:${TAG}|g" {} \;
223-
224- # - name: Commit and push changes
225- # run: |
226- # git config --local user.email "action@github.com"
227- # git config --local user.name "GitHub Action"
228- # git add deployments/
229- # git diff --staged --quiet || git commit -m "Update deployment manifests for ${GITHUB_REF#refs/tags/}"
230- # git push
220+ # Update image tags in deployment files
221+ find deployments -name "*.yaml" -type f -exec \
222+ sed -i "s|image: .*openspp:.*|image: ${{ env.PUBLIC_REGISTRY }}/${{ env.IMAGE_NAME }}:${TAG}|g" {} \;
223+
224+ - name : Commit and push changes
225+ run : |
226+ git config --local user.email "action@github.com"
227+ git config --local user.name "GitHub Action"
228+ git add deployments/
229+ git diff --staged --quiet || git commit -m "Update deployment manifests for ${GITHUB_REF#refs/tags/}"
230+ git push
231231
232- # notify:
233- # name: Send Notifications
234- # needs: [build-ubuntu, build-slim]
235- # runs-on: ubuntu-latest
236- # if: always() && github.event_name != 'pull_request'
232+ notify :
233+ name : Send Notifications
234+ needs : [build-ubuntu, build-slim]
235+ runs-on : ubuntu-latest
236+ if : always() && github.event_name != 'pull_request'
237237
238- # steps:
239- # - name: Notify Slack
240- # uses: 8398a7/action-slack@v3
241- # if: always()
242- # continue-on-error: true
243- # with:
244- # status: ${{ job.status }}
245- # text: |
246- # OpenSPP Docker Build ${{ job.status }}
247- # Branch: ${{ github.ref }}
248- # Commit: ${{ github.sha }}
249- # Images pushed to: ${{ env.PUBLIC_REGISTRY }}/${{ env.IMAGE_NAME }}
250- # webhook_url: ${{ secrets.SLACK_WEBHOOK }}
251- # env:
252- # SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
238+ steps :
239+ - name : Notify Slack
240+ uses : 8398a7/action-slack@v3
241+ if : always()
242+ continue-on-error : true
243+ with :
244+ status : ${{ job.status }}
245+ text : |
246+ OpenSPP Docker Build ${{ job.status }}
247+ Branch: ${{ github.ref }}
248+ Commit: ${{ github.sha }}
249+ Images pushed to: ${{ env.PUBLIC_REGISTRY }}/${{ env.IMAGE_NAME }}
250+ webhook_url : ${{ secrets.SLACK_WEBHOOK }}
251+ env :
252+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK }}
0 commit comments