-
Notifications
You must be signed in to change notification settings - Fork 0
Chore: [AEA-0000] - verify installs #96
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
Changes from all commits
8b483e7
59c6589
e92681d
ab1dfd5
076d4e0
ee2515c
d678d60
74c6d02
e985d4d
d80dcb3
c4dc1ab
d92d215
40211f0
bb77bf1
1c65c83
108804c
4e2b61c
b6914cf
350e1ff
1278843
508d94f
d24971d
28228dc
7d4e807
9569fe5
0127a8f
00da81d
2737b8d
4854610
8a6f3bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ guard-%: | |
| .PHONY: install install-python install-node install-hooks build-base-image build-node-24-image build-node-24-python-3-10-image build-node-24-python-3-12-image build-node-24-python-3-13-image build-node-24-python-3-14-image \ | ||
| build-eps-storage-terraform-image build-eps-data-extract-image build-fhir-facade-image build-node-24-python-3-14-golang-1-24-image build-node-24-python-3-14-java-24-image \ | ||
| build-regression-tests-image build-all build-image build-githubactions-image scan-image scan-image-json shell-image lint test lint-githubactions lint-githubaction-scripts clean \ | ||
| build-syft build-grype build-grant build-tflint | ||
| build-syft build-grype build-grant build-tflint build-tools build-zizmor | ||
| install: install-python install-node install-hooks | ||
|
|
||
| install-python: | ||
|
|
@@ -89,14 +89,35 @@ build-tflint: | |
| @if docker image inspect local_tflint:latest >/dev/null 2>&1; then \ | ||
| echo "Image local_tflint:latest already exists. Skipping build."; \ | ||
| else \ | ||
| if [ -z "$$GITHUB_TOKEN" ]; then \ | ||
| echo "GITHUB_TOKEN environment variable not set. Please set it by running 'make github-login' and setting GITHUB_TOKEN to the value of 'gh auth token'."; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| docker buildx build \ | ||
| --secret id=GH_TOKEN,env=GITHUB_TOKEN \ | ||
| -f src/projects/eps-storage-terraform/.devcontainer/Dockerfile.tflint \ | ||
| -f src/base/.devcontainer/Dockerfile.tflint \ | ||
| --tag local_tflint:latest \ | ||
| src/projects/eps-storage-terraform/.devcontainer/; \ | ||
| src/base/.devcontainer/; \ | ||
|
Comment on lines
96
to
+100
|
||
| fi | ||
|
|
||
| build-image: build-syft build-grype build-grant build-tflint guard-CONTAINER_NAME guard-BASE_VERSION_TAG guard-BASE_FOLDER guard-IMAGE_TAG | ||
| build-zizmor: | ||
| @if docker image inspect local_zizmor:latest >/dev/null 2>&1; then \ | ||
| echo "Image local_zizmor:latest already exists. Skipping build."; \ | ||
| else \ | ||
| if [ -z "$$GITHUB_TOKEN" ]; then \ | ||
| echo "GITHUB_TOKEN environment variable not set. Please set it by running 'make github-login' and setting GITHUB_TOKEN to the value of 'gh auth token'."; \ | ||
| exit 1; \ | ||
| fi; \ | ||
| docker buildx build \ | ||
| --secret id=GH_TOKEN,env=GITHUB_TOKEN \ | ||
| -f src/base/.devcontainer/Dockerfile.zizmor \ | ||
| --tag local_zizmor:latest \ | ||
| src/base/.devcontainer/; \ | ||
|
Comment on lines
+111
to
+115
|
||
| fi | ||
|
|
||
| build-tools: build-syft build-grype build-grant build-tflint build-zizmor | ||
|
|
||
| build-image: build-tools guard-CONTAINER_NAME guard-BASE_VERSION_TAG guard-BASE_FOLDER guard-IMAGE_TAG | ||
| workspace_folder="$${CONTAINER_NAME}"; \ | ||
| case "$${CONTAINER_NAME}" in \ | ||
| eps_*) workspace_folder="$$(printf '%s' "$${CONTAINER_NAME}" | tr '_' '-')" ;; \ | ||
|
|
@@ -149,6 +170,18 @@ lint-githubaction-scripts: | |
|
|
||
| clean: | ||
| rm -rf .out | ||
| docker image rm local_syft:latest || true | ||
| docker image rm local_grype:latest || true | ||
| docker image rm local_grant:latest || true | ||
| docker image rm local_tflint:latest || true | ||
| docker image rm local_zizmor:latest || true | ||
|
|
||
| deep-clean: clean | ||
| rm -rf .venv | ||
| find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + | ||
| poetry env remove --all | ||
| docker images --format "{{.Repository}}:{{.Tag}}" | grep ":local-build" | xargs -r docker rmi -f | ||
|
|
||
|
|
||
| %: | ||
| @$(MAKE) -f /usr/local/share/eps/Mk/common.mk $@ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,2 @@ | ||
| shellcheck 0.11.0 | ||
| direnv 2.37.1 | ||
| actionlint 1.7.12 | ||
| ruby 3.3.0 | ||
| yq 4.52.5 |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| FROM serversideup/github-cli:2.89.0 AS build | ||
| ARG TARGETARCH | ||
| ARG TFLINT_VERSION="v0.61.0" | ||
| COPY --chmod=755 scripts/install_github_release.sh /tmp/install_github_release.sh | ||
| RUN --mount=type=secret,id=GH_TOKEN,env=GH_TOKEN \ | ||
| case "${TARGETARCH}" in \ | ||
| x86_64|amd64) DOWNLOAD_BINARY=tflint_linux_amd64.zip ;; \ | ||
| aarch64|arm64) DOWNLOAD_BINARY=tflint_linux_arm64.zip ;; \ | ||
| *) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \ | ||
| esac \ | ||
| && INSTALL_DIR=/tmp/tflint/ \ | ||
| ARCH="${TARGETARCH}" \ | ||
| VERSION="${TFLINT_VERSION}" \ | ||
| GITHUB_REPO="terraform-linters/tflint" \ | ||
| TOOL="tflint" \ | ||
| DOWNLOAD_BINARY="${DOWNLOAD_BINARY}" \ | ||
| VERIFY_BINARY_ATTESTATION="false" \ | ||
| VERIFY_CHECKSUM="true" \ | ||
| COMPRESSION="zip" \ | ||
| /tmp/install_github_release.sh | ||
|
|
||
| FROM scratch | ||
| COPY --from=build /tmp/tflint/tflint /tflint | ||
| ENTRYPOINT ["/tflint"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| FROM serversideup/github-cli:2.89.0 AS build | ||
| ARG TARGETARCH | ||
| ARG ZIZMOR_VERSION="v1.24.1" | ||
| COPY --chmod=755 scripts/install_github_release.sh /tmp/install_github_release.sh | ||
| RUN --mount=type=secret,id=GH_TOKEN,env=GH_TOKEN \ | ||
| case "${TARGETARCH}" in \ | ||
| x86_64|amd64) DOWNLOAD_BINARY=zizmor-x86_64-unknown-linux-gnu.tar.gz ;; \ | ||
| aarch64|arm64) DOWNLOAD_BINARY=zizmor-aarch64-unknown-linux-gnu.tar.gz ;; \ | ||
| *) echo "Unsupported TARGETARCH: ${TARGETARCH}" && exit 1 ;; \ | ||
| esac \ | ||
| && INSTALL_DIR=/tmp/zizmor/ \ | ||
| ARCH="${TARGETARCH}" \ | ||
| VERSION="${ZIZMOR_VERSION}" \ | ||
| GITHUB_REPO="zizmorcore/zizmor" \ | ||
| TOOL="zizmor" \ | ||
| DOWNLOAD_BINARY="${DOWNLOAD_BINARY}" \ | ||
| VERIFY_BINARY_ATTESTATION="true" \ | ||
| VERIFY_CHECKSUM="false" \ | ||
| COMPRESSION="tar.gz" \ | ||
| /tmp/install_github_release.sh | ||
|
|
||
| FROM scratch | ||
| COPY --from=build /tmp/zizmor/zizmor /zizmor | ||
| ENTRYPOINT ["/zizmor"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| VERSION=${VERSION:-"v0.18.1"} | ||
| # Expected SHA256 checksums taken from https://github.com/asdf-vm/asdf/releases/tag/v0.18.1 | ||
| # When we change asdf versions, these must be changed | ||
| sha256sum_expected_arm="sha256:1850faf576cab7acb321e99dd98d3fe0d4665e1331086ad9ed991aeec1dc9d36" | ||
| sha256sum_expected_amd64="sha256:56141dc99eab75c140dcdd85cf73f3b82fed2485a8dccd4f11a4dc5cbcb6ea5c" | ||
|
|
||
| if [ "$(id -u)" -ne 0 ]; then | ||
| echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Checks if packages are installed and installs them if not | ||
| check_packages() { | ||
| if ! dpkg -s "$@" > /dev/null 2>&1; then | ||
| apt-get -y install --no-install-recommends "$@" | ||
| fi | ||
| } | ||
|
|
||
| check_packages curl ca-certificates tar | ||
|
|
||
| install() { | ||
| tmp_dir="$(mktemp -d)" | ||
| trap 'rm -rf "${tmp_dir}"' EXIT | ||
|
|
||
| download_file="${tmp_dir}/asdf.tar.gz" | ||
|
|
||
| if [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" == "aarch64" ]; then | ||
| download_url="https://github.com/asdf-vm/asdf/releases/download/${VERSION}/asdf-${VERSION}-linux-arm64.tar.gz" | ||
| sha256sum_expected="${sha256sum_expected_arm}" | ||
| else | ||
| download_url="https://github.com/asdf-vm/asdf/releases/download/${VERSION}/asdf-${VERSION}-linux-amd64.tar.gz" | ||
| sha256sum_expected="${sha256sum_expected_amd64}" | ||
| fi | ||
| curl -fsSL "${download_url}" -o "${download_file}" | ||
|
|
||
| download_file_sha256sum=$(sha256sum "${download_file}" | awk '{print $1}') | ||
| if [ "${download_file_sha256sum}" != "${sha256sum_expected#sha256:}" ]; then | ||
| echo "SHA256 checksum mismatch for downloaded asdf archive" | ||
| echo "Expected: ${sha256sum_expected}" | ||
| echo "Actual: sha256:${download_file_sha256sum}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| tar -xzf "${download_file}" -C "${tmp_dir}" | ||
| mkdir -p /usr/bin | ||
| mv "${tmp_dir}/asdf" /usr/bin/asdf | ||
| chmod +x /usr/bin/asdf | ||
| } | ||
| echo "(*) Installing asdf..." | ||
|
|
||
| install | ||
|
|
||
| echo "Done!" |
Uh oh!
There was an error while loading. Please reload this page.