Skip to content

Commit 276106b

Browse files
authored
Merge branch 'build' into master
2 parents d64ec09 + 118678f commit 276106b

15 files changed

+329
-17
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
registries:
3+
docker-registry-quay-io:
4+
type: docker-registry
5+
url: https://quay.io
6+
username: "${{secrets.DEPENDABOT_USER}}"
7+
password: "${{secrets.DEPENDABOT_PASS}}"
8+
updates:
9+
- package-ecosystem: "docker"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
registries:
14+
- docker-registry-quay-io
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build and scan
2+
3+
# Controls when the action will run. Triggers the workflow on push or pull request
4+
# events but only for the master branch
5+
on:
6+
push:
7+
branches: [ build ]
8+
9+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
10+
jobs:
11+
# This workflow contains a single job called "build"
12+
build:
13+
env:
14+
VERSION: latest
15+
EXPORTER_NAME: elasticsearch-exporter
16+
# The type of runner that the job will run on
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v1
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v1
25+
- name: Login to Artifactory
26+
uses: docker/login-action@v1
27+
with:
28+
registry: artifactory.internal.sysdig.com
29+
30+
password: ${{ secrets.ARTI_TOKEN }}
31+
- name: Increase version and build
32+
run: |
33+
docker pull artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION
34+
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 .
37+
38+
- name: Scan local image
39+
id: scan-local
40+
uses: sysdiglabs/scan-action@v3
41+
with:
42+
image-tag: "elasticsearch-exporter:latest"
43+
sysdig-secure-token: ${{ secrets.SYSDIG_SECURE_TOKEN }}
44+
ignore-failed-scan: true
45+
input-type: docker-daemon
46+
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
56+
57+
- name: Sarif report
58+
uses: github/codeql-action/upload-sarif@v1
59+
if: always()
60+
with:
61+
sarif_file: ${{ steps.scan-local.outputs.sarifReport }}
62+
63+
- name: Change the tag of the image
64+
run: |
65+
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
67+
68+
- name: Push the image
69+
run: |
70+
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION
71+
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:$VERSION-ubi
72+
73+
- name: Fake Upload master to Quay.io
74+
uses: fjogeleit/http-request-action@master
75+
with:
76+
url: 'https://sysdig-jenkins.internal.sysdig.com/view/Integrations/job/integrations-elasticsearch-exporter/buildWithParameters?token=${{ secrets.JENKINS_PROMCAT_LAUNCH_TOKEN }}&EXPORTER=elasticsearch-exporter&DRY_RUN=true'
77+
method: 'POST'
78+
79+
password: ${{ secrets.JENKINS_PROMCAT_API_TOKEN }}

.github/workflows/release.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on:
2+
release:
3+
types: [released]
4+
name: Build, test and publish
5+
jobs:
6+
buildDockerImage:
7+
env:
8+
EXPORTER_NAME: elasticsearch-exporter
9+
name: Build docker image
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Login to Artifactory
14+
uses: docker/login-action@v1
15+
with:
16+
registry: artifactory.internal.sysdig.com
17+
18+
password: ${{ secrets.ARTI_TOKEN }}
19+
- name: Release if tagged
20+
if: "!startswith(github.ref, 'refs/tags/v')"
21+
run: exit 78
22+
- name: Build image
23+
run: |
24+
docker build --label release=${{ github.event.release.tag_name }} -f Dockerfile --target scratch -t artifactory.internal.sysdig.com/$EXPORTER_NAME:latest .
25+
docker build --label release=${{ github.event.release.tag_name }} -f Dockerfile --target ubi -t artifactory.internal.sysdig.com/$EXPORTER_NAME:${{ github.event.release.tag_name }}-ubi .
26+
- name: Publish docker image
27+
run: |
28+
docker tag artifactory.internal.sysdig.com/$EXPORTER_NAME:latest artifactory.internal.sysdig.com/$EXPORTER_NAME:${{ github.event.release.tag_name }}
29+
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:${{ github.event.release.tag_name }}
30+
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:${{ github.event.release.tag_name }}-ubi
31+
docker push artifactory.internal.sysdig.com/$EXPORTER_NAME:latest
32+
- name: Upload master to Quay.io
33+
uses: fjogeleit/http-request-action@master
34+
with:
35+
url: 'https://sysdig-jenkins.internal.sysdig.com/view/Integrations/job/integrations-elasticsearch-exporter/buildWithParameters?token=${{ secrets.JENKINS_PROMCAT_LAUNCH_TOKEN }}&EXPORTER=elasticsearch-exporter&DRY_RUN=false'
36+
method: 'POST'
37+
38+
password: ${{ secrets.JENKINS_PROMCAT_API_TOKEN }}

.gometalinter.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"Cyclo": 40,
3+
"Deadline": "6m",
4+
"EnableGC": true,
5+
"Exclude": ["TLS InsecureSkipVerify set true.",
6+
"Potential file inclusion via variable",
7+
"Errors unhandled.,LOW,HIGH"
8+
],
9+
"Sort": ["linter", "severity", "path", "line"]
10+
}

.idea/.gitignore

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/elasticsearch_exporter.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: go
2+
3+
go:
4+
- 1.16.x
5+
- tip
6+
7+
script:
8+
- make style
9+
- make vet
10+
- make build
11+
- make test
12+
13+
matrix:
14+
allow_failures:
15+
- go: tip

0 commit comments

Comments
 (0)