Skip to content

Fix cast package tests for linux/arm32 #1368

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

Merged
merged 1 commit into from
Feb 24, 2025
Merged

Conversation

hslatman
Copy link
Member

@hslatman hslatman commented Feb 24, 2025

Fixes #1367.

In the absence of arm32 runners in our CI, I've tested this locally with a Dockerfile roughly equivalent to this (based on the cli Dockerfile):

FROM --platform=linux/arm golang:alpine AS builder

WORKDIR /src
COPY go.mod go.sum .
RUN go mod download
COPY . .
RUN apk add --no-cache make git curl

ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT

RUN --mount=type=cache,target=/root/.cache/go-build \
    --mount=type=cache,target=/go/pkg \
    GOOS="${TARGETOS}"; \
    GOARCH="${TARGETARCH}"; \
    if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" ]; then \
    GOARM="${TARGETVARIANT#v}"; \
    fi; \
    CGO_ENABLED=0 GOOS_OVERRIDE="GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM}" \
    go test -timeout 30s github.com/smallstep/cli/internal/cast 

RUN --mount=type=cache,target=/root/.cache/go-build \
    --mount=type=cache,target=/go/pkg \
    GOOS="${TARGETOS}"; \
    GOARCH="${TARGETARCH}"; \
    if [ "${TARGETARCH}" = "arm" ] && [ "${TARGETVARIANT}" ]; then \
    GOARM="${TARGETVARIANT#v}"; \
    fi; \
    CGO_ENABLED=0 GOOS_OVERRIDE="GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM}" \
    make V=1 bin/step

FROM alpine

ENV STEP="/home/step"
ENV STEPPATH="/home/step"
ARG STEPUID=1000
ARG STEPGID=1000

RUN apk update \
        && apk upgrade \
        && apk add --no-cache bash curl tzdata \
        && addgroup -g ${STEPGID} step \
        && adduser -D -u ${STEPUID} -G step step \
        && chown step:step /home/step

COPY --from=builder /src/bin/step "/usr/local/bin/step"

USER step
WORKDIR /home/step

STOPSIGNAL SIGTERM

CMD /bin/bash

@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Feb 24, 2025
@hslatman hslatman marked this pull request as ready for review February 24, 2025 11:50
@hslatman hslatman requested review from a team and azazeal February 24, 2025 11:50
@hslatman hslatman added this to the v0.28.4 milestone Feb 24, 2025
@hslatman hslatman merged commit 2eaf582 into master Feb 24, 2025
17 checks passed
@hslatman hslatman deleted the herman/fix-cast-test-32bit branch February 24, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Failing go test github.com/smallstep/cli/internal/cast on 32bit patforms
2 participants