Skip to content

Commit b3512cd

Browse files
committed
Change build workflow
1 parent 7d13c0f commit b3512cd

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

.github/workflows/image-builder-workflow.yaml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@ on:
1010
jobs:
1111
# This workflow contains a single job called "build"
1212
build:
13+
strategy:
14+
matrix:
15+
docker: ['scratch','ubi']
1316
env:
1417
VERSION: latest
1518
EXPORTER_NAME: elasticsearch-exporter
1619
# The type of runner that the job will run on
1720
runs-on: ubuntu-latest
21+
name: ${{ matrix.docker }}
1822
steps:
1923
- name: Checkout
2024
uses: actions/checkout@v2
@@ -32,8 +36,7 @@ jobs:
3236
run: |
3337
docker pull artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION
3438
export RELEASE=$(docker inspect --format '{{ index .Config.Labels "release" }}' artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION)
35-
docker build --label release=$RELEASE -f Dockerfile -t $EXPORTER_NAME:$VERSION --target scratch .
36-
docker build --label version=$RELEASE -f Dockerfile -t $EXPORTER_NAME:$VERSION-ubi --target ubi .
39+
docker build --label release=$RELEASE -f Dockerfile -t $EXPORTER_NAME:$VERSION --target ${{ matrix.docker }} .
3740
3841
- name: Scan local image
3942
id: scan-local
@@ -44,15 +47,6 @@ jobs:
4447
ignore-failed-scan: true
4548
input-type: docker-daemon
4649
run-as-user: root
47-
- name: Scan local image 2
48-
id: scan-local2
49-
uses: sysdiglabs/scan-action@v3
50-
with:
51-
image-tag: "elasticsearch-exporter:latest-ubi"
52-
sysdig-secure-token: ${{ secrets.SYSDIG_SECURE_TOKEN }}
53-
ignore-failed-scan: true
54-
input-type: docker-daemon
55-
run-as-user: root
5650

5751
- name: Sarif report
5852
uses: github/codeql-action/upload-sarif@v1
@@ -63,12 +57,10 @@ jobs:
6357
- name: Change the tag of the image
6458
run: |
6559
docker tag $EXPORTER_NAME:$VERSION artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION
66-
docker tag $EXPORTER_NAME:$VERSION-ubi artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION-ubi
6760
6861
- name: Push the image
6962
run: |
7063
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION
71-
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION-ubi
7264
7365
- name: Fake Upload master to Quay.io
7466
uses: fjogeleit/http-request-action@master

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM quay.io/prometheus/golang-builder as builder
33
ADD . /go/src/github.com/prometheus-community/elasticsearch_exporter
44
WORKDIR /go/src/github.com/prometheus-community/elasticsearch_exporter
55

6+
RUN go mod download
67
RUN make
78

89
FROM scratch as scratch

0 commit comments

Comments
 (0)