GoogleContainerTools / GoogleContainerTools/container-structure-test
[Gitlab CI] First run always fails
- Dominant language
- Go
- Stars
- 2.5k
- Forks
- 212
- PR merge metrics
- No merged PRs in 30d
Description
I am using this tool in my Gitlab CI pipeline with the below config file
```
schemaVersion: '2.0.0'
fileExistenceTests:
- name: 'Run Script Check'
path: '/run.sh'
shouldExist: true
permissions: '-rw-rw-rw-'
```
Command being executed
```
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v ${PWD}/_ci/cst-config.yaml:/cst-config.yaml:ro gcr.io/gcp-runtimes/container-structure-test:latest test --image ${CONTAINER_REGISTRY}:${CI_PIPELINE_ID} --config /cst-config.yaml
```
On the first run, I get the following error
```
=== RUN: Run Script Check
--- FAIL
Error: error setting env vars: Error creating container: no such image
```
When the job is rerun, it passes without any issues.
```
=== RUN: File Existence Test: Run Script Check
--- PASS
```
I have tried pulling both the test candidate image and `gcr.io/gcp-runtimes/container-structure-test:latest` image in a previous step before running the test.
Could you please suggest what needs to be done to make the tests pass on the first attempt.
Contributor guide
Assessment
This issue has not been assessed yet.