Skip to content

Commit

Permalink
cicd: add workflow for checking a pull request contribution
Browse files Browse the repository at this point in the history
- builds the project, executes tests and deploys the helm charts
  • Loading branch information
nicoprow committed May 27, 2024
1 parent 12ef180 commit d5be2bc
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
124 changes: 124 additions & 0 deletions .github/workflows/check-contribution.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
################################################################################
# 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:
check-apps:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- 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/chart-testing-action@v2.6.1
- name: Maven Build And Test
run: mvn clean package -B
- name: Docker Build Pool
uses: docker/build-push-action@v5
with:
context: .
push: true
file: docker/bpdm-app/Dockerfile
tags: kind-registry:5000/bpdm-pool:test
build-args: 'JAR_PATH=./bpdm-pool/target/bpdm-pool.jar'
- name: Docker Build Gate
uses: docker/build-push-action@v5
with:
context: .
push: true
file: docker/bpdm-app/Dockerfile
tags: kind-registry:5000/bpdm-gate:test
build-args: 'JAR_PATH=./bpdm-gate/target/bpdm-gate.jar'
- name: Docker Build Orchestrator
uses: docker/build-push-action@v5
with:
context: .
push: true
file: docker/bpdm-app/Dockerfile
tags: kind-registry:5000/bpdm-orchestrator:test
build-args: 'JAR_PATH=./bpdm-orchestrator/target/bpdm-orchestrator.jar'
- name: Docker Build Cleaning Dummy
uses: docker/build-push-action@v5
with:
context: .
push: true
file: docker/bpdm-app/Dockerfile
tags: kind-registry:5000/bpdm-cleaning-service-dummy:test
build-args: 'JAR_PATH=./bpdm-cleaning-service-dummy/target/bpdm-cleaning-service-dummy.jar'
- name: Create Test Values
run: |
cat <<EOF > .ci/values-test.yml
bpdm-gate:
image:
registry: kind-registry:5000
repository: bpdm-gate
tag: test
bpdm-pool:
image:
registry: kind-registry:5000
repository: bpdm-pool
tag: test
bpdm-orchestrator:
image:
registry: kind-registry:5000
repository: bpdm-orchestrator
tag: test
bpdm-cleaning-service-dummy:
image:
registry: kind-registry:5000
repository: bpdm-cleaning-service-dummy
tag: test
EOF
echo "cat .ci/values-test.yml"
cat .ci/values-test.yml
- name: Create Chart-Testing Config
run: |
cat <<EOF > .chart-testing-config.yaml
validate-maintainers: false
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
12 changes: 12 additions & 0 deletions docker/bpdm-app/Dockerfile
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"]

0 comments on commit d5be2bc

Please sign in to comment.