GoogleContainerTools / GoogleContainerTools/container-structure-test
Env var expansion feature in commandTests output assertions
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
Would it be possible to get some env var expansion in output assertions of commandTests?
```
schemaVersion: 2.0.0
fileExistenceTests:
- name: 'Go Binary is present and executable'
path: '/usr/local/go/bin/go'
shouldExist: true
permissions: '-rwxr-xr-x'
isExecutableBy: 'root'
uid: 0
gid: 0
commandTests:
- name: 'Go version cmd to check go version'
command: 'go'
args: ['version']
expectedOutput: ['^go version go${GO_VERSION}.+$']
```
The associated container build spec is following one:
```
ARG BASE_VERSION
FROM docker.something.com/base-build:${BASE_VERSION}
USER root
ARG GOLANG_VERSION=1.21.3
ARG DEBIAN_FRONTEND=noninteractive
ENV GOPROXY https://artifactory.something.com/artifactory/go-remote/
ENV GONOSUMDB github.something.com/*
ENV PATH /usr/local/go/bin:${PATH}
ENV GOPATH /go
ENV GOLANG_VERSION=${GOLANG_VERSION}
RUN mkdir -p ${GOPATH} && \
curl "https://artifactory.something.com/artifactory/go-linux-remote/go${GOLANG_VERSION}.linux-amd64.tar.gz" --output /tmp/go.tar.gz && \
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/go.tar.gz && \
rm /tmp/go.tar.gz
ARG GIT_SHA
ARG GIT_BRANCH
CMD ["/bin/bash"]
```
Thx for your help
Contributor guide
Assessment
This issue has not been assessed yet.