-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cicd: add workflow for checking a pull request contribution
- builds the project, executes tests and deploys the helm charts
- Loading branch information
Showing
2 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
################################################################################ | ||
# Copyright (c) 2021,2024 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0. | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
################################################################################ | ||
|
||
name: Package - Maven Project | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build-docker-pool: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Build Pool Image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: docker/pool/Dockerfile | ||
tags: kind-registry:5000/bpdm-pool:test | ||
outputs: type=docker,dest=/tmp/bpdm-pool.tar | ||
- name: Upload Pool Image | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bpdm-pool-docker | ||
path: /tmp/bpdm-pool.tar | ||
|
||
execute-chart-tests: | ||
needs: build-docker-pool | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download Pool Image | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: bpdm-pool-docker | ||
path: /tmp | ||
- name: Load Pool Image | ||
run: docker load --input /tmp/bpdm-pool.tar | ||
- name: Kubernetes KinD Cluster | ||
uses: container-tools/kind-action@v2 | ||
with: | ||
version: v0.20.0 | ||
node_image: ${{ github.event.inputs.node_image || 'kindest/node:v1.27.3' }} | ||
- name: Set up Helm | ||
uses: azure/setup-helm@v4 | ||
with: | ||
version: ${{ github.event.inputs.helm_version || 'latest' }} | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
check-latest: true | ||
- name: Set up chart-testing | ||
uses: helm/[email protected] | ||
- name: Push Pool Image to Kind | ||
run: docker push kind-registry:5000/bpdm-pool:test | ||
- name: Create Test Values | ||
run: | | ||
mkdir charts/ci | ||
cat <<EOF > charts/ci/test-values.yml | ||
bpdm-pool: | ||
image: | ||
registry: kind-registry:5000 | ||
repository: bpdm-pool | ||
tag: test | ||
EOF | ||
echo "cat charts/ci/test-values.yml" | ||
cat charts/ci/test-values.yml | ||
- name: Create Chart-Testing Config | ||
run: | | ||
cat <<EOF > .chart-testing-config.yaml | ||
chart-repos: | ||
- bitnami=https://charts.bitnami.com/bitnami | ||
helm-extra-args: --timeout 600s | ||
EOF | ||
echo "cat .chart-testing-config.yaml" | ||
cat .chart-testing-config.yaml | ||
- name: Run chart-testing (install) | ||
run: ct install --charts charts/bpdm --config .chart-testing-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM eclipse-temurin:21-jre-alpine | ||
ARG USERNAME=bpdm | ||
ARG USERID=10001 | ||
ARG GID=10001 | ||
ARG JAR_PATH=. | ||
COPY $JAR_PATH /usr/local/lib/bpdm/app.jar | ||
RUN addgroup -g $GID -S $USERNAME | ||
RUN adduser -u $USERID -S $USERNAME $USERNAME | ||
USER $USERNAME | ||
WORKDIR /usr/local/lib/bpdm | ||
EXPOSE 8080 | ||
ENTRYPOINT ["java","-jar","app.jar"] |