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

feat(ci): add win32 build #187

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 33 additions & 13 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]
needs: [build-settings, update-builder]
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
Loading