bradleyd / devops_for_the_desperate

The companion code for the book DevOps for the Desperate
111 stars 62 forks source link

[Chapter 8] Configuration file backwards incompatibility in container-structure-test #21

Closed NaykiSec closed 1 year ago

NaykiSec commented 1 year ago

Hello Bradley,

First of all thanks for the book it's awesome :)

While doing the chapter 8 i encountered an error with the skaffold dev --cleanup=false command, more precisely this error :

=======================================================
====== Test file: command-and-metadata-test.yaml ======
=======================================================
=== RUN: 
--- FAIL
duration: 0s
Error: error parsing config file: error unmarshalling config: yaml: unmarshal errors:
  line 8: field env not found in type v2.MetadataTest

=======================================================
======================= RESULTS =======================
=======================================================
Passes:      0
Failures:    1
Duration:    0s
Total tests: 1

FAIL
time="2023-01-07T13:15:03+01:00" level=fatal msg=FAIL
running tests: running container-structure-test: error running container-structure-test command: exit status 1

I didn't change the command-and-metadata-test.yaml file. I searched a bit and the configuration files of container-structure changed with version 1.13.0 More information here :
https://github.com/GoogleContainerTools/container-structure-test/issues/322

I checked my container-structure-test = v1.14.0

TLDR; env field is now called envVars

I resolved the issue by modifying the line 8 of command-and-metadata-test.yaml

schemaVersion: 2.0.0
commandTests:
  - name: "telnet-server"
    command: "./telnet-server"
    args: ["-i"]
    expectedOutput: ["telnet port :2323\nMetrics Port: :9000"]
metadataTest:
  envVars:
    - key: TELNET_PORT
      value: 2323
    - key: METRIC_PORT
      value: 9000
  entrypoint: ["./telnet-server"]
  workdir: "/app"

I don't know if the contributors behind container-structure-test are going to fix this, but just wanted to warn you about this current problem :)

bradleyd commented 1 year ago

@NaykiSec Thanks for posting an issue. I hope it was not too much of a pain.

I figured I would run into version changes breaking configuration files eventually 😄 I appreciate you running that down for all the readers. I will wait on container-structure-test maintainers to respond if they are going to add the backwards compat back in. If not, I will just make a note on the README and update the YAML.

I am really glad you are enjoying the book!

Take care.

bradleyd commented 1 year ago

I have merged in the vars change. There has been no movement really to speak of upstream. I am going to close this issue. Thanks for raising it.