forked from cryostatio/cryostat-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (126 loc) · 3.97 KB
/
container-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Build Container Image
concurrency:
group: ci-${{ github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
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+miwan_test
CI_REGISTRY: quay.io/redhat-java-monitoring
CI_IMG: quay.io/redhat-java-monitoring/quarkus-cryostat-agent
jobs:
build-agent:
runs-on: ubuntu-latest
outputs:
image-version: ${{ steps.get-agent-version.outputs.agent-version }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- id: get-agent-version
run: |
echo "agent-version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> $GITHUB_OUTPUT
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
- run: mvn -B -U clean install
build-quarkus-test-app:
needs: [build-agent]
runs-on: ubuntu-latest
strategy:
matrix:
java: ['17']
permissions:
packages: write
contents: read
pull-requests: write
statuses: write
outputs:
quay-image: ${{ steps.quarkus-test-image.outputs.image }}
env:
agent-version: ${{ needs.build-agent.outputs.image-version }}
name: Build Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Get date tag
run: echo "DATE_TAG=$(date -uI)" >> "$GITHUB_ENV"
- uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'maven'
- uses: actions/checkout@v4
with:
repository: cryostatio/test-applications
ref: main
submodules: true
fetch-depth: 0
- run: cd quarkus-agent
- name: Build application
run: ./mvnw -B -U -Dio.cryostat.agent.version=${{ env.agent-version }} clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build container images and manifest
id: buildah-build
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.CI_IMG }}
archs: amd64
tags: ${{ env.agent-version }} ${{env.DATE_TAG}}
containerfiles: |
./quarkus-agent/src/main/docker/Dockerfile.jvm
- name: Push to quay.io
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
with:
image: quarkus-cryostat-agent
tags: ${{ steps.buildah-build.outputs.tags }}
registry: ${{ env.CI_REGISTRY }}
username: ${{ env.CI_USER }}
password: ${{ secrets.REPOSITORY_TOKEN }}
- name: store quarkus-agent image as output
id: quarkus-agent-image
run: echo "image=${{ steps.push-to-quay.outputs.registry-path }}" >> $GITHUB_OUTPUT
comment-image:
runs-on: ubuntu-latest
needs: [build-quarkus-test-app]
env:
image: ${{ needs.build-quarkus-test-app.outputs.quay-image }}
permissions:
pull-requests: write
steps:
- name: Create markdown table
id: md-table
uses: petems/[email protected]
with:
csvinput: |
ARCH, IMAGE
amd64, ${{ env.image }}
- uses: thollander/actions-comment-pull-request@v2
with:
message: |-
${{ steps.md-table.outputs.markdown-table }}