Skip to content

Commit

Permalink
🔧 Fix Terrascan installation on non x86 (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Woffenden <[email protected]>
  • Loading branch information
Jacob Woffenden authored Apr 9, 2024
1 parent 96f10b9 commit 783180d
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 49 deletions.
38 changes: 0 additions & 38 deletions .github/actions/setup-container-structure-test/action.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ jobs:
id: checkout
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- name: Set Up Google Container Structure Test
- name: Set Up Container Structure Test
id: setup_container_structure_test
uses: ./.github/actions/setup-container-structure-test
uses: ministryofjustice/github-actions/setup-container-structure-test@bdab1cff6d23336b6d5adc662fb57af72f0ae160 # v17.1.0

- name: Set Up QEMU
id: setup_qemu
Expand All @@ -170,6 +170,7 @@ jobs:
id: container_structure_test
run: |
container-structure-test test \
--platform ${{ matrix.platform }} \
--config images/${{ matrix.image }}/test/container-structure-test.yml \
--image ghcr.io/ministryofjustice/devcontainer-${{ matrix.image }}:${{ github.sha }}
Expand Down
8 changes: 7 additions & 1 deletion features/src/aws/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- markdownlint-disable MD003 -->
<!-- markdownlint-disable MD003 MD024 -->
# Changelog

All notable changes to this project will be documented in this file.
Expand All @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.3] - 2024-04-08

### Changed

- Switch to `uname --machine`

## [0.0.2] - 2024-01-31

### Changed
Expand Down
2 changes: 1 addition & 1 deletion features/src/aws/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "aws",
"version": "0.0.2",
"version": "0.0.3",
"name": "AWS",
"description": "Installs the AWS CLI and AWS SSO CLI",
"options": {
Expand Down
4 changes: 2 additions & 2 deletions features/src/aws/install-aws-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ get_system_architecture
VERSION="${AWSCLIVERSION:-"latest"}"

if [[ "${VERSION}" == "latest" ]]; then
ARTEFACT="awscli-exe-linux-$(uname -m).zip"
ARTEFACT="awscli-exe-linux-$(uname --machine).zip"
else
ARTEFACT="awscli-exe-linux-$(uname -m)-${VERSION}.zip"
ARTEFACT="awscli-exe-linux-$(uname --machine)-${VERSION}.zip"
fi

curl --fail-with-body --location "https://awscli.amazonaws.com/${ARTEFACT}" \
Expand Down
6 changes: 6 additions & 0 deletions features/src/static-analysis/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.3] - 2024-04-08

### Changed

- Fix architecture for non x86

## [0.0.2] - 2024-04-05

## Added
Expand Down
2 changes: 1 addition & 1 deletion features/src/static-analysis/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "static-analysis",
"version": "0.0.2",
"version": "0.0.3",
"name": "Static Analysis",
"description": "Installs Checkov, Terrascan and Trivy",
"options": {
Expand Down
7 changes: 5 additions & 2 deletions features/src/static-analysis/install-terrascan-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ else
VERSION_STRIP_V="${VERSION#v}"
fi

ARCHITECTURE=$(uname --machine)
export ARCHITECTURE
if [[ "${ARCHITECTURE}" == "amd64" ]]; then
ARCHITECTURE="x86_64"
else
ARCHITECTURE="arm64"
fi

curl --fail-with-body --location "https://github.com/${GITHUB_REPOSITORY}/releases/download/${VERSION}/terrascan_${VERSION_STRIP_V}_Linux_${ARCHITECTURE}.tar.gz" \
--output "terrascan_${VERSION_STRIP_V}_Linux_${ARCHITECTURE}.tar.gz"
Expand Down
5 changes: 5 additions & 0 deletions images/base/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.6] - 2024-04-08

### Changed

- Switch to `uname --machine`

## [0.0.5] - 2024-02-13

Expand Down
2 changes: 1 addition & 1 deletion images/base/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "base",
"version": "0.0.5"
"version": "0.0.6"
}
2 changes: 1 addition & 1 deletion images/base/src/usr/local/bin/devcontainer-utils
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ logger() {
}

get_system_architecture() {
systemArchitecture="$(uname -m)"
systemArchitecture="$(uname --machine)"
export systemArchitecture

case ${systemArchitecture} in
Expand Down

0 comments on commit 783180d

Please sign in to comment.