-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
919dc36
commit 261d7c0
Showing
9 changed files
with
136 additions
and
32 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,93 @@ | ||
name: Build Container Image | ||
|
||
concurrency: | ||
group: ci-${{ github.run_id }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 0 * * 1' # every Monday at midnight | ||
push: | ||
branches: | ||
- main | ||
- v[0-9]+ | ||
- v[0-9]+.[0-9]+ | ||
- cryostat-v[0-9]+.[0-9]+ | ||
|
||
env: | ||
OPENSUSE_UNOFFICIAL_LIBCONTAINERS_KEY_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/Release.key" | ||
OPENSUSE_UNOFFICIAL_LIBCONTAINERS_SOURCE_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04" | ||
CI_USER: redhat-java-monitoring+github_ci | ||
CI_REGISTRY: quay.io | ||
CI_NAMESPACE: redhat-java-monitoring | ||
|
||
jobs: | ||
get-agent-version: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository_owner == 'cryostatio' }} | ||
outputs: | ||
image-version: ${{ steps.get-agent-version.outputs.agent-version }} | ||
hash-key: ${{ steps.get-hash-key.outputs.hash-key }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository_owner }}/cryostat-agent | ||
ref: ${{ github.ref }} | ||
submodules: true | ||
fetch-depth: 0 | ||
- id: get-agent-version | ||
run: | | ||
echo "agent-version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> $GITHUB_OUTPUT | ||
- id: get-hash-key | ||
run: | | ||
echo "hash-key=${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}" >> $GITHUB_OUTPUT | ||
- run: mvn -B -U clean install | ||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ steps.get-hash-key.outputs.hash-key }} | ||
|
||
build-and-push: | ||
needs: [get-agent-version] | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: ['17'] | ||
env: | ||
agent-version: ${{ needs.get-agent-version.outputs.image-version }} | ||
name: Build Java ${{ matrix.java }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- name: Restore Maven Cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ needs.get-agent-version.outputs.hash-key }} | ||
restore-keys: | | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- name: Install qemu | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: 'temurin' | ||
- name: Get date tag | ||
run: echo "DATE_TAG=$(date -uI)" >> "$GITHUB_ENV" | ||
- name: Registry login | ||
run: podman login quay.io --username=${{ env.CI_USER }} --password=${{ secrets.REPOSITORY_TOKEN }} | ||
- name: Build application | ||
run: ./build.bash | ||
env: | ||
TAGS: ${{ env.agent-version }} ${{env.DATE_TAG}} latest | ||
PUSH_MANIFEST: true | ||
APP_REGISTRY: ${{ env.CI_REGISTRY }} | ||
APP_NAMESPACE: ${{ env.CI_NAMESPACE }} | ||
BUILD_TAG: ${{ env.agent-version }} | ||
CRYOSTAT_AGENT_VERSION: ${{ env.agent-version }} |
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
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 @@ | ||
cache/* |
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 |
---|---|---|
@@ -1,21 +1,2 @@ | ||
ARG CRYOSTAT_AGENT_VERSION=0.5.0-SNAPSHOT | ||
|
||
FROM registry.access.redhat.com/ubi8/openjdk-11:latest AS agentloader | ||
ARG CRYOSTAT_AGENT_VERSION | ||
USER 0 | ||
RUN mkdir -p /opt/cryostat && \ | ||
mvn dependency:get -Dartifact="io.cryostat:cryostat-agent:${CRYOSTAT_AGENT_VERSION}:jar:shaded" && \ | ||
mvn dependency:copy -Dartifact="io.cryostat:cryostat-agent:${CRYOSTAT_AGENT_VERSION}:jar:shaded" -DoutputDirectory=/opt/cryostat \ | ||
|| true | ||
RUN if [ ! -f "/opt/cryostat/cryostat-agent-${CRYOSTAT_AGENT_VERSION}-shaded.jar" ]; then \ | ||
microdnf install git; \ | ||
git clone https://github.com/cryostatio/cryostat-agent; \ | ||
cd cryostat-agent; \ | ||
mvn -DskipTests package; \ | ||
cp "target/cryostat-agent-${CRYOSTAT_AGENT_VERSION}-shaded.jar" /opt/cryostat/; \ | ||
fi | ||
|
||
FROM docker.io/itzg/minecraft-server:java21-jdk | ||
ARG CRYOSTAT_AGENT_VERSION | ||
RUN mkdir -p /opt/cryostat | ||
COPY --from=agentloader /opt/cryostat/cryostat-agent-${CRYOSTAT_AGENT_VERSION}-shaded.jar /opt/cryostat/agent.jar | ||
COPY ./cache/cryostat-agent-*-shaded.jar /opt/cryostat/agent.jar |
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
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
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
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
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