Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test integration - sysdig #317

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
50b8e6c
Update README.md
DannyJS-933 Nov 28, 2023
4456d73
testing the integration
DannyJS-933 Nov 28, 2023
66656ea
Create build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
9b01268
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
b2f2e9d
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
d4f0ebb
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
6c94546
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
f99ffc4
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
8aaf242
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
f14d941
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
93e6d41
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
75c6528
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
09924c3
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
b45ed98
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
4f7e2da
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
7aba82f
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
8f25667
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
dfd5280
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
6419aa5
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
1807bf0
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
29942fe
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
fa02425
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
ac775cc
Update build-scan-and-push.yaml
DannyJS-933 Nov 29, 2023
0234473
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
005764e
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
37617d4
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
ad4f233
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
b142179
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
a18720d
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
f04ede7
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
a8c84d3
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
f20c721
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
039149f
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
5b0efe4
Update build-scan-and-push.yaml
DannyJS-933 Nov 30, 2023
bbc6b6e
test
DannyJS-933 Nov 30, 2023
60a1d01
Merge branch 'main' of https://github.com/DannyJS-933/example-voting-app
DannyJS-933 Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/build-scan-and-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
env:
SYSDIG_SECURE_ENDPOINT: "https://app.us4.sysdig.com/"
REGISTRY_HOST: "ghcr.io"
IMAGE_NAME: "dockersamples"
IMAGE_TAG: "vote"
DOCKERFILE_CONTEXT: "https://github.com/DannyJS-933/example-voting-app.git#main:vote"

name: Container build, scan and push

on: [push, pull_request]

jobs:
build-scan-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build and save
uses: docker/build-push-action@v3
with:
context: ${{ env.DOCKERFILE_CONTEXT }}
tags: ${{ env.REGISTRY_HOST }}/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
load: true

- name: Setup cache
uses: actions/cache@v3
with:
path: cache
key: ${{ runner.os }}-cache-${{ hashFiles('**/sysdig-cli-scanner', '**/latest_version.txt', '**/db/main.db.meta.json', '**/scanner-cache/inlineScannerCache.db') }}
restore-keys: ${{ runner.os }}-cache-

- name: Download sysdig-cli-scanner if needed
run: |
curl -sLO https://download.sysdig.com/scanning/sysdig-cli-scanner/latest_version.txt
mkdir -p ${GITHUB_WORKSPACE}/cache/db/
if [ ! -f ${GITHUB_WORKSPACE}/cache/latest_version.txt ] || [ $(cat ./latest_version.txt) != $(cat ${GITHUB_WORKSPACE}/cache/latest_version.txt) ]; then
cp ./latest_version.txt ${GITHUB_WORKSPACE}/cache/latest_version.txt
curl -sL -o ${GITHUB_WORKSPACE}/cache/sysdig-cli-scanner "https://download.sysdig.com/scanning/bin/sysdig-cli-scanner/$(cat ${GITHUB_WORKSPACE}/cache/latest_version.txt)/linux/amd64/sysdig-cli-scanner"
chmod +x ${GITHUB_WORKSPACE}/cache/sysdig-cli-scanner
else
echo "sysdig-cli-scanner latest version already downloaded"
fi

- name: Scan the image using sysdig-cli-scanner
env:
SECURE_API_TOKEN: ${{ secrets.SECURE_API_TOKEN }}
run: |
${GITHUB_WORKSPACE}/cache/sysdig-cli-scanner \
--apiurl ${SYSDIG_SECURE_ENDPOINT} \
docker://${REGISTRY_HOST}/${{ secrets.REGISTRY_USER }}/${IMAGE_NAME}:${IMAGE_TAG} \
--console-log \
--dbpath=${GITHUB_WORKSPACE}/cache/db/ \
--cachepath=${GITHUB_WORKSPACE}/cache/scanner-cache/

- name: Login to the registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY_HOST }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_TOKEN }}

- name: Push
uses: docker/build-push-action@v3
with:
context: ${{ env.DOCKERFILE_CONTEXT }}
push: true
tags: ${{ env.REGISTRY_HOST }}/${{ secrets.REGISTRY_USER }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
1 change: 1 addition & 0 deletions .github/workflows/call-docker-build-vote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ jobs:
### Create a PR comment with image tags and labels
### defaults to false
# comment-enable: false

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Example Voting App

A simple distributed application running across multiple Docker containers.
A simple distributed application running across multiple Docker containers.

***Note: This is a forked repository from the original repository https://github.com/dockersamples/example-voting-app.git, which belongs to Sysdig. It is intended solely for lab-testing purposes.***

## Getting started

Expand Down
2 changes: 2 additions & 0 deletions k8s-specifications/vote-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ spec:
nodePort: 31000
selector:
app: vote

##This is just a test...