From 68c004d64caf454b7316ad93f2ca8f5dc21b21a5 Mon Sep 17 00:00:00 2001 From: Ilya Sabelnikov Date: Tue, 6 Dec 2022 23:10:01 +0200 Subject: [PATCH] feat: adds support for arm64 (M1) architecture while installing goss (#168) * Adds support for arm64 architecture while installing goss * Add tests * Keep new lines --- .circleci/test-deploy.yml | 18 ++++++++++++++++++ src/commands/install-docker-tools.yml | 8 ++++++++ src/commands/install-goss.yml | 8 ++++++++ src/scripts/install-goss.sh | 4 ++-- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/.circleci/test-deploy.yml b/.circleci/test-deploy.yml index 758fd2e..9cbe5ea 100644 --- a/.circleci/test-deploy.yml +++ b/.circleci/test-deploy.yml @@ -27,6 +27,7 @@ promotion_requires: &promotion_requires test-install-docker-tools-macos-old, test-install-docker-tools-machine-latest, test-install-docker-tools-machine-old, + test-install-docker-tools-machine-arm, test-install-docker-compose-with-checksums, test-install-docker-compose-with-sha256, test-install-docker-compose-with-checksums-and-sha256, @@ -90,12 +91,17 @@ jobs: debug: type: boolean default: false + goss-architecture: + type: enum + default: amd64 + enum: [ amd64, arm64 ] executor: <> steps: - checkout - jq/install - docker/install-docker-tools: install-goss-dgoss: << parameters.install-goss >> + goss-architecture: << parameters.goss-architecture >> test-pull: executor: docker-latest steps: @@ -514,6 +520,14 @@ workflows: matrix: parameters: executor: [docker-latest, docker-old, machine-latest, machine-old] + goss-architecture: [amd64] + filters: *filters + - test-install-docker-tools: + name: test-install-docker-tools-<< matrix.executor >> + matrix: + parameters: + executor: [machine-arm] + goss-architecture: [arm64] filters: *filters - test-install-docker-tools: name: test-install-docker-tools-<< matrix.executor >> @@ -574,5 +588,9 @@ executors: machine-latest: machine: image: ubuntu-2004:current + machine-arm: + resource_class: arm.medium + machine: + image: ubuntu-2004:202101-01 # VS Code Extension Version: 1.3.0 diff --git a/src/commands/install-docker-tools.yml b/src/commands/install-docker-tools.yml index 7fa5c37..8a991e4 100644 --- a/src/commands/install-docker-tools.yml +++ b/src/commands/install-docker-tools.yml @@ -102,6 +102,13 @@ parameters: description: > Extra output for orb developers + goss-architecture: + type: enum + default: amd64 + enum: [ amd64, arm64 ] + description: > + Which Goss architecture to use. Supports `arm64` architecture from `v0.3.18` and newer. + steps: - when: condition: <> @@ -131,3 +138,4 @@ steps: version: <> install-dir: <> debug: <> + architecture: <> diff --git a/src/commands/install-goss.yml b/src/commands/install-goss.yml index 2823ee6..7bc4da5 100644 --- a/src/commands/install-goss.yml +++ b/src/commands/install-goss.yml @@ -27,6 +27,13 @@ parameters: description: > Extra output for orb developers + architecture: + type: enum + default: amd64 + enum: [ amd64, arm64 ] + description: > + Which Goss architecture to use. Supports `arm64` architecture from `v0.3.18` and newer. + steps: - run: name: Install Goss and dgoss @@ -34,5 +41,6 @@ steps: PARAM_VERSION: <> PARAM_INSTALL_DIR: <> PARAM_DEBUG: <> + PARAM_ARCHITECTURE: <> SCRIPT_UTILS: <> command: << include(scripts/install-goss.sh) >> diff --git a/src/scripts/install-goss.sh b/src/scripts/install-goss.sh index f42b3e1..1a0b489 100644 --- a/src/scripts/install-goss.sh +++ b/src/scripts/install-goss.sh @@ -42,9 +42,9 @@ fi # download/install # goss curl -O --silent --show-error --location --fail --retry 3 \ - "https://github.com/aelsabbahy/goss/releases/download/$VERSION/goss-linux-amd64" + "https://github.com/aelsabbahy/goss/releases/download/$VERSION/goss-linux-$PARAM_ARCHITECTURE" -$SUDO mv goss-linux-amd64 "$PARAM_INSTALL_DIR"/goss +$SUDO mv goss-linux-$PARAM_ARCHITECTURE "$PARAM_INSTALL_DIR"/goss $SUDO chmod +rx /usr/local/bin/goss # test/verify goss