Skip to content

Commit

Permalink
Merge pull request #5453 from snyk/chore/alpine_arm64_e2e
Browse files Browse the repository at this point in the history
feat(deployment): Deploy alpine arm64 binaries
  • Loading branch information
PeterSchafer authored Sep 2, 2024
2 parents 38fe054 + 10e7102 commit 6c8153f
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 6 deletions.
50 changes: 47 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ orbs:
executors:
alpine:
docker:
- image: alpine:3.17
- image: alpine:3.20
resource_class: xlarge
alpine-arm64:
docker:
- image: alpine:3.20
resource_class: arm.xlarge
generic-ubuntu:
docker:
- image: ubuntu:latest
Expand Down Expand Up @@ -329,12 +333,21 @@ commands:
- run:
name: Installing Node.js + other test dependencies
command: |
apk add --update nodejs npm bash maven git gradle python3 py3-pip elixir composer
arch=$(uname -m)
case "$arch" in
aarch64) arch="arm64";;
*) arch="amd64";;
esac
echo "using architecture: $arch"
apk add --update nodejs npm bash maven git python3 py3-pip elixir composer unzip
pip3 install pipenv requests PyYAML setuptools==70.3.0
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && chmod +x dotnet-install.sh && ./dotnet-install.sh
wget https://go.dev/dl/go<< pipeline.parameters.go_version >>.linux-amd64.tar.gz -O /tmp/go.tgz && \
wget https://go.dev/dl/go<< pipeline.parameters.go_version >>.linux-$arch.tar.gz -O /tmp/go.tgz && \
tar -C /usr/local -xzvf /tmp/go.tgz && \
ln -s /usr/local/go/bin/go /usr/local/bin
wget https://services.gradle.org/distributions/gradle-8.10-bin.zip -O /tmp/gradle.zip && \
unzip -d /usr/local /tmp/gradle.zip && \
ln -s /usr/local/gradle-8.10/bin/gradle /usr/local/bin
failed-release-notification:
steps:
Expand Down Expand Up @@ -477,6 +490,17 @@ workflows:
requires:
- prepare-build

- build-artifact:
name: build alpine arm64
go_target_os: alpine
go_os: linux
go_arch: arm64
go_download_base_url: << pipeline.parameters.go_download_base_url >>
executor: docker-arm64
c_compiler: /usr/bin/musl-gcc
requires:
- prepare-build

- build-artifact:
name: build macOS amd64
go_target_os: darwin
Expand Down Expand Up @@ -590,6 +614,23 @@ workflows:
install_deps_extension: alpine-full
dont_skip_tests: 0

- acceptance-tests:
name: acceptance-tests alpine arm64
context:
- nodejs-install
- team_hammerhead-cli
filters:
branches:
ignore:
- main
- '/release.*/'
requires:
- build alpine arm64
executor: alpine-arm64
test_snyk_command: ./binary-releases/snyk-alpine-arm64
install_deps_extension: alpine-full
dont_skip_tests: 0

- acceptance-tests:
name: acceptance-tests macOS amd64
context:
Expand Down Expand Up @@ -686,6 +727,7 @@ workflows:
- sign macos arm64
- sign windows amd64
- build alpine amd64
- build alpine arm64
- build linux amd64
- build linux arm64
- build fix & protect
Expand Down Expand Up @@ -1127,6 +1169,8 @@ jobs:
default: 3
executor: << parameters.executor >>
parallelism: << parameters.shards >>
environment:
PIP_BREAK_SYSTEM_PACKAGES: 1
steps:
- prepare-workspace
- install-deps-<< parameters.install_deps_extension >>
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-alpine: prepack | $(BINARY_RELEASES_FOLDER
$(PKG) -t node$(PKG_NODE_VERSION)-alpine-x64 -o $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-alpine
$(MAKE) $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-alpine.sha256

$(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-alpine-arm64: prepack | $(BINARY_RELEASES_FOLDER_TS_CLI)
$(PKG) -t node$(PKG_NODE_VERSION)-alpine-arm64 -o $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-alpine-arm64 --no-bytecode
$(MAKE) $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-alpine-arm64.sha256

$(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-linux: prepack | $(BINARY_RELEASES_FOLDER_TS_CLI)
$(PKG) -t node$(PKG_NODE_VERSION)-linux-x64 -o $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-linux
$(MAKE) $(BINARY_RELEASES_FOLDER_TS_CLI)/snyk-linux.sha256
Expand Down Expand Up @@ -266,7 +270,7 @@ release-pre:
@echo "-- Validating artifacts"
@./release-scripts/validate-checksums.sh
@echo "-- Validating upload permissions"
@./release-scripts/upload-artifacts.sh --dry-run preview latest github npm
@./release-scripts/upload-artifacts.sh --dry-run latest github npm
@echo "-- Publishing to S3 /version"
@./release-scripts/upload-artifacts.sh version

Expand Down
3 changes: 2 additions & 1 deletion binary-deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"amd64": "snyk-win.exe"
},
"alpine": {
"amd64": "snyk-alpine"
"amd64": "snyk-alpine",
"arm64": "snyk-alpine-arm64"
},
"linux": {
"amd64": "snyk-linux",
Expand Down
5 changes: 5 additions & 0 deletions release-scripts/release.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
"sha256": "snyk-alpine-sha256",
"sha256Url": "https://downloads.snyk.io/cli/v1.0.0-monorepo/snyk-alpine.sha256"
},
"snyk-alpine-arm64": {
"url": "https://downloads.snyk.io/cli/v1.0.0-monorepo/snyk-alpine-arm64",
"sha256": "snyk-alpine-arm64-sha256",
"sha256Url": "https://downloads.snyk.io/cli/v1.0.0-monorepo/snyk-alpine-arm64.sha256"
},
"snyk-linux": {
"url": "https://downloads.snyk.io/cli/v1.0.0-monorepo/snyk-linux",
"sha256": "snyk-linux-sha256",
Expand Down
2 changes: 2 additions & 0 deletions release-scripts/upload-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ PROTOCOL_VERSION_FILE=$(basename "$(/bin/ls binary-releases/ls-protocol-version*
declare -a StaticFiles=(
"binary-releases/$PROTOCOL_VERSION_FILE"
"binary-releases/snyk-alpine"
"binary-releases/snyk-alpine-arm64"
"binary-releases/snyk-linux"
"binary-releases/snyk-linux-arm64"
"binary-releases/snyk-macos"
"binary-releases/snyk-macos-arm64"
"binary-releases/snyk-win.exe"
"binary-releases/snyk-alpine.sha256"
"binary-releases/snyk-alpine-arm64.sha256"
"binary-releases/snyk-linux.sha256"
"binary-releases/snyk-linux-arm64.sha256"
"binary-releases/snyk-macos.sha256"
Expand Down
2 changes: 1 addition & 1 deletion ts-binary-wrapper/test/acceptance/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jest.setTimeout(60 * 1000);
describe('Basic acceptance test', () => {
const envSetup = new TestEnvironmentSetup();
const cliVersionForTesting =
'1.1228.0-dev.b6d3a5aed7033dd2fe9fcc1330effeca0e4250b2';
'1.1294.0-dev.fb7d0fdb0ab3beb8af7142c84ded754b568ba2f4';

beforeEach(async () => {
process.env.SNYK_DISABLE_ANALYTICS = '1';
Expand Down

0 comments on commit 6c8153f

Please sign in to comment.