Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <roberto.scolaro21@gmail.com>
  • Loading branch information
therealbobo committed Jun 6, 2024
1 parent 14d967e commit 024fb73
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 25 deletions.
44 changes: 32 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,38 +25,58 @@ jobs:
print(f'version={version}'.lower(), file=ofp)
print(f'semver={semver}'.lower(), file=ofp)
update-builder:
env:
REGISTRY: ghcr.io
BUILDER_IMAGE: ghcr.io/draios/sysdig-inspect-builder

runs-on: ubuntu-latest
steps:
- name: Checkout Sysdig
uses: actions/checkout@v3

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

- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build new builder
id: build-skeleton-builder
uses: docker/build-push-action@v3
with:
context: .
file: build/Dockerfile
tags: ${{ format('{0}:dev,{0}:{1}', env.BUILDER_IMAGE, github.sha) }}
push: true


build-sysdig-inspect:
needs: [build-settings]
env:
BUILDER: "sysdiglabs/sysdig-inspect-builder:0.2"
BUILDER: "ghcr.io/draios/sysdig-inspect-builder:dev"
SEMVER: ${{ needs.build-settings.outputs.semver }}
VERSION: ${{ needs.build-settings.outputs.version }}

runs-on: ubuntu-latest
container:
image: "sysdiglabs/sysdig-inspect-builder:0.2"
image: "ghcr.io/draios/sysdig-inspect-builder:dev"
env:
INSTALL_DEPS: true
GIT_BRANCH: dev
SEMVER: ${{ needs.build-settings.outputs.semver }}
VERSION: ${{ needs.build-settings.outputs.version }}
BUILD_MAC: true
BUILD_WIN32: true
volumes:
- /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Checkout Sysdig
uses: actions/checkout@v3
- name: install 7z
run: |
cd /tmp
sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf &&
update-ca-certificates -f &&
curl -L -o 7z.tar.xz https://www.7-zip.org/a/7z2301-linux-x64.tar.xz &&
tar -xaf 7z.tar.xz &&
mv 7zz /usr/bin/7z &&
rm -vfr /tmp/* &&
cd -
- name: Build sysdig-inspect
run: ./build/build.sh
- name: Upload artifacts rpm
Expand Down
30 changes: 17 additions & 13 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM debian:stable-slim
FROM debian:buster



Expand All @@ -24,18 +24,22 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \

# Install the latest Docker CE binaries
# From https://github.com/getintodevops/jenkins-withdocker/blob/master/Dockerfile
RUN apt-get install -y \
apt-transport-https \
ca-certificates \
gnupg2 \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt-get update -qq && \
apt-get install -y docker-ce
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y \
apt-transport-https \
wine wine32 \
ca-certificates \
gnupg2 \
p7zip-full \
software-properties-common && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg > /tmp/dkey; apt-key add /tmp/dkey && \
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") \
$(lsb_release -cs) \
stable" && \
apt-get update -qq && \
apt-get install -y docker-ce

# Cleanup
RUN apt-get clean && \
Expand Down
50 changes: 50 additions & 0 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

SYSDIG_VERSION="0.37.1"
SYSDIG_VERSION_MAC="0.37.1"
SYSDIG_VERSION_WIN32="0.37.1"

# Env parameters
# - CLEANUP (default: true)
Expand Down Expand Up @@ -47,6 +48,14 @@ setup_env() {
then
BUILD_MAC_INSTALLER=false
fi
if [ -z ${BUILD_WIN32} ]
then
BUILD_WIN32=true
fi
if [ -z ${BUILD_WIN32_INSTALLER} ]
then
BUILD_WIN32_INSTALLER=false
fi
if [ -z ${ENVIRONMENT} ]
then
ENVIRONMENT=development
Expand Down Expand Up @@ -126,6 +135,20 @@ install_dependencies() {
cp -v sysdig-${SYSDIG_VERSION_MAC}-x86_64/bin/csysdig deps/sysdig-mac/
cp -vr sysdig-${SYSDIG_VERSION_MAC}-x86_64/share/sysdig/chisels deps/sysdig-mac/
fi

if [ "${BUILD_WIN32}" = "true" ] || [ "${BUILD_WIN32_INSTALLER}" = "true" ]; then
# WIN32 binaries

mkdir -p deps/sysdig-win32/chisels
mkdir win32
cd win32
curl -L -o sysdig-installer.exe "https://github.com/draios/sysdig/releases/download/${SYSDIG_VERSION_WIN32}/sysdig-${SYSDIG_VERSION_WIN32}-AMD64.exe"
7z e sysdig-installer.exe || true
cd ..
cp -v win32/sysdig.exe deps/sysdig-win32/
cp -v win32/csysdig.exe deps/sysdig-win32/
cp -v win32/*.lua deps/sysdig-win32/chisels
fi
fi
}

Expand Down Expand Up @@ -211,6 +234,33 @@ build() {
cp electron-out/make/Sysdig\ Inspect-${INSPECT_USER_VERSION}.dmg out/mac/installers/sysdig-inspect-mac-x86_64.dmg
fi
fi

if [ "${BUILD_WIN32}" = "true" ] || [ "${BUILD_WIN32_INSTALLER}" = "true" ]; then
#
# build WIN32 package
#
rm -rf out/win32

rm -rf ember-electron/resources/sysdig
npm run bundle -- deps/sysdig-mac
if [ "${BUILD_WIN32}" = "true" ]; then
npm run package:win -- --environment ${ENVIRONMENT} --user-tracking-key ${USER_TRACKING_KEY}
fi
if [ "${BUILD_WIN32_INSTALLER}" = "true" ]; then
npm run make:win -- --environment ${ENVIRONMENT} --user-tracking-key ${USER_TRACKING_KEY}
fi

cd electron-out
ls -lah
zip -ry Sysdig\ Inspect-darwin-x64.zip Sysdig\ Inspect-darwin-x64
cd ..
mkdir -p out/mac/binaries
cp electron-out/Sysdig\ Inspect-darwin-x64.zip out/mac/binaries/sysdig-inspect-mac-x86_64.zip
if [ "${BUILD_WIN32_INSTALLER}" = "true" ]; then
mkdir -p out/mac/installers
cp electron-out/make/Sysdig\ Inspect-${INSPECT_USER_VERSION}.dmg out/mac/installers/sysdig-inspect-mac-x86_64.dmg
fi
fi
}

cleanup() {
Expand Down

0 comments on commit 024fb73

Please sign in to comment.