Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release of SLIM Java Starterkit Sample Project #5

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .ci/Dockerfile.buildDeploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# docker image rm slim:mavenbuilddeploy ; docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) --network=host --tag "slim:mavenbuilddeploy" --force-rm --no-cache --file ".ci/Dockerfile.buildDeploy" .
# docker run --rm -it -v ${PWD}:${PWD} -v ${HOME}/.m2:$PWD/.m2 -v ${HOME}/.m2:/home/jenkins/.m2 -w ${PWD} --user "${UID_GID}" slim:mavenbuilddeploy
FROM maven:3.6.3-openjdk-11

ARG DEBIAN_FRONTEND=noninteractive
ARG GID=500
ARG UID=500
ARG USR=jenkins
ARG WORKSPACE="/home/${USR}"

ENV CONTAINERIZED="true"
ENV HOME="${WORKSPACE}"
ENV PATH="${PATH}:."

# https://issues.jenkins-ci.org/browse/JENKINS-47026
RUN { getent group ${GID} || groupadd -f -g ${GID} ${USR} ; } && \
{ getent passwd ${UID} || useradd -u ${UID} -s /bin/sh -d ${HOME} -g ${GID} ${USR} ; }

# basic user environment -- includes jq, python and testrail reporter
RUN mkdir -p ${HOME} && chmod 777 ${HOME} && \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using chmod 777 on the user's home directory (${HOME}) might be too permissive.
How about chown instead?
chown -R ${USR}:${USR} ${HOME}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great observation. It is running inside the container so I was assuming this was only affecting the mount inside the container. In this context, the container is only executed ephemerally and stops after the job completes. I definitely need to review some of this earlier stuff to tighten it up, so I will.

Please bear with me as there will be more content to review shortly. I've kept it in draft until it's ready for thorough review.

apt-get update && \
apt-get install -y --no-install-recommends \
jq \
python3-wheel \
python3-dev \
python3-setuptools \
python3-pip && \
python3 -m pip install behave-testrail-reporter>=0.4.0

ENTRYPOINT /bin/bash
33 changes: 33 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven Build/Test/Package

on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -U clean package

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
3 changes: 3 additions & 0 deletions CITATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Citation

If you use any of these algorithms in your work, please directly cite this repository.
Loading
Loading