Skip to content

Commit 0ff3305

Browse files
Added container images push to GH packages
1 parent 6f62607 commit 0ff3305

File tree

2 files changed

+52
-27
lines changed

2 files changed

+52
-27
lines changed

.github/workflows/build-forwarder.yaml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
- master
66
paths:
77
- .github/workflows/build-forwarder.yml
8-
- AKSKubeAuditReceiverSolution/
8+
- AKSKubeAuditReceiverSolution/**
99
pull_request:
1010
branches:
1111
- master
1212
paths:
1313
- .github/workflows/build-forwarder.yml
14-
- AKSKubeAuditReceiverSolution/
14+
- AKSKubeAuditReceiverSolution/**
1515
workflow_dispatch:
1616
release:
1717
types:
@@ -116,8 +116,7 @@ jobs:
116116
publish_image:
117117
name: Publish container image to registries
118118
needs: [sysdig_image_scan]
119-
runs-on: ubuntu-16.04
120-
if: github.event_name == 'release'
119+
runs-on: ubuntu-16.04
121120
steps:
122121
- name: Checkout
123122
uses: actions/checkout@v2
@@ -130,12 +129,6 @@ jobs:
130129
with:
131130
username: ${{ secrets.DOCKERHUB_USERNAME }}
132131
password: ${{ secrets.DOCKERHUB_PASSWORD }}
133-
- name: Login to GitHub Container Registry
134-
uses: docker/login-action@v1
135-
with:
136-
registry: ghcr.io
137-
username: ${{ github.repository_owner }}
138-
password: ${{ secrets.CR_PAT_PKG }}
139132
- name: Prepare version labels
140133
id: prepare_version_labels
141134
env:
@@ -144,13 +137,13 @@ jobs:
144137
echo "Version tag: $VERSION_TAG"
145138
VERSION_MAJOR=$(echo $VERSION_TAG | sed 's/[^0-9]*\([0-9]\+\).*/\1/')
146139
VERSION_FULL=$(echo $VERSION_TAG | sed 's/[^0-9]*\([0-9]\+.*\)/\1/')
147-
[ -z $VERSION_FULL ] VERSION_FULL="master"
148-
[ -z $VERSION_MAJOR ] VERSION_FULL="master"
140+
[ -z $VERSION_FULL ] && VERSION_FULL="master"
141+
[ -z $VERSION_MAJOR ] && VERSION_MAJOR="dev"
149142
echo "Version major: $VERSION_MAJOR"
150143
echo "Version full: $VERSION_FULL"
151144
echo "::set-output name=VERSION_MAJOR::$VERSION_MAJOR"
152145
echo "::set-output name=VERSION_FULL::$VERSION_FULL"
153-
- name: Build and push
146+
- name: Build and push Docker Hub
154147
uses: docker/build-push-action@v2
155148
with:
156149
context: AKSKubeAuditReceiverSolution/
@@ -161,3 +154,20 @@ jobs:
161154
sysdiglabs/aks-audit-log-forwarder:latest
162155
sysdiglabs/aks-audit-log-forwarder:${{ steps.prepare_version_labels.outputs.VERSION_MAJOR }}
163156
sysdiglabs/aks-audit-log-forwarder:${{ steps.prepare_version_labels.outputs.VERSION_FULL }}
157+
- name: Login to GitHub Container Registry
158+
if: github.event_name == 'release'
159+
uses: docker/login-action@v1
160+
with:
161+
registry: docker.pkg.github.com
162+
username: ${{ secret.CR_PAT_PKG_USER }}
163+
password: ${{ secrets.CR_PAT_PKG }}
164+
- name: Build and push GitHub Packages
165+
if: github.event_name == 'release'
166+
uses: docker/build-push-action@v2
167+
with:
168+
context: AKSKubeAuditReceiverSolution/
169+
file: AKSKubeAuditReceiverSolution/AKSKubeAuditReceiver/Dockerfile
170+
platforms: linux/amd64
171+
push: true
172+
tags: |
173+
docker.pkg.github.com/sysdiglabs/aks-audit-log/aks-audit-log-forwarder:${{ steps.prepare_version_labels.outputs.VERSION_FULL }}

.github/workflows/build-installer.yaml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,23 @@ jobs:
107107
SCAN_RESULT=${PIPESTATUS[0]}
108108
echo "::set-output name=SCAN_RESULT::$SCAN_RESULT"
109109
echo "Scan finished with result: $SCAN_RESULT"
110-
- name: Scan result
110+
- name: SCAN RESULT
111111
env:
112112
SCAN_RESULT: ${{ steps.run_sysdig_inline_scan.outputs.SCAN_RESULT }}
113113
run: |
114114
cat sysdig_image_scan_result.txt
115-
echo "Scan result: $SCAN_RESULT"
116-
# exit $SCAN_RESULT
115+
echo ; echo "******************************"
116+
[ "$SCAN_RESULT" -eq 0 ] && echo "** Scan result > PASS < **"
117+
[ "$SCAN_RESULT" -eq 1 ] && echo "** Scan result > FAIL < **"
118+
[ "$SCAN_RESULT" -eq 2 ] && echo "** Wrong script invokation **"
119+
[ "$SCAN_RESULT" -eq 3 ] && echo "** Runtime error **"
120+
echo "******************************" ; echo
121+
exit $SCAN_RESULT
117122
118123
publish_images:
119124
name: Publish container images to registries
120125
needs: [sysdig_image_scan]
121-
runs-on: ubuntu-16.04
122-
if: github.event_name == 'release'
126+
runs-on: ubuntu-16.04
123127
steps:
124128
- name: Checkout
125129
uses: actions/checkout@v2
@@ -132,12 +136,6 @@ jobs:
132136
with:
133137
username: ${{ secrets.DOCKERHUB_USERNAME }}
134138
password: ${{ secrets.DOCKERHUB_PASSWORD }}
135-
- name: Login to GitHub Container Registry
136-
uses: docker/login-action@v1
137-
with:
138-
registry: ghcr.io
139-
username: ${{ github.repository_owner }}
140-
password: ${{ secrets.CR_PAT_PKG }}
141139
- name: Prepare version labels
142140
id: prepare_version_labels
143141
env:
@@ -146,13 +144,13 @@ jobs:
146144
echo "Version tag: $VERSION_TAG"
147145
VERSION_MAJOR=$(echo $VERSION_TAG | sed 's/[^0-9]*\([0-9]\+\).*/\1/')
148146
VERSION_FULL=$(echo $VERSION_TAG | sed 's/[^0-9]*\([0-9]\+.*\)/\1/')
149-
[ -z $VERSION_FULL ] VERSION_FULL="master"
150-
[ -z $VERSION_MAJOR ] VERSION_FULL="master"
147+
[ -z $VERSION_FULL ] && VERSION_FULL="master"
148+
[ -z $VERSION_MAJOR ] && VERSION_MAJOR="dev"
151149
echo "Version major: $VERSION_MAJOR"
152150
echo "Version full: $VERSION_FULL"
153151
echo "::set-output name=VERSION_MAJOR::$VERSION_MAJOR"
154152
echo "::set-output name=VERSION_FULL::$VERSION_FULL"
155-
- name: Build and push
153+
- name: Build and push Docker Hub
156154
uses: docker/build-push-action@v2
157155
with:
158156
context: .
@@ -163,3 +161,20 @@ jobs:
163161
sysdiglabs/aks-audit-log-installer:latest
164162
sysdiglabs/aks-audit-log-installer:${{ steps.prepare_version_labels.outputs.VERSION_MAJOR }}
165163
sysdiglabs/aks-audit-log-installer:${{ steps.prepare_version_labels.outputs.VERSION_FULL }}
164+
- name: Login to GitHub Packages
165+
if: github.event_name == 'release'
166+
uses: docker/login-action@v1
167+
with:
168+
registry: docker.pkg.github.com
169+
username: ${{ github.CR_PAT_PKG_USER }}
170+
password: ${{ secrets.CR_PAT_PKG }}
171+
- name: Build and push GitHub Packages
172+
if: github.event_name == 'release'
173+
uses: docker/build-push-action@v2
174+
with:
175+
context: .
176+
file: ./build/Dockerfile
177+
platforms: linux/amd64
178+
push: true
179+
tags: |
180+
docker.pkg.github.com/sysdiglabs/aks-audit-log/aks-audit-log-installer:${{ steps.prepare_version_labels.outputs.VERSION_FULL }}

0 commit comments

Comments
 (0)