distributable:
  url: https://github.com/stackrox/kube-linter/archive/v{{version}}.tar.gz
  strip-components: 1

versions:
  github: stackrox/kube-linter

build:
  dependencies:
    go.dev: ^1.21
  script:
    go build $ARGS -ldflags="$LDFLAGS" ./cmd/kube-linter
  env:
    CGO_ENABLED: 0
    LDFLAGS:
      - -s
      - -w
      - -X golang.stackrox.io/kube-linter/internal/version.version={{version}}
    ARGS:
      - -trimpath
      - -o={{prefix}}/bin/kube-linter
    linux:
      ARGS:
        - -buildmode=pie

provides:
  - bin/kube-linter

test:
  - kube-linter version | grep {{version}}
  - run: kube-linter lint $FIXTURE 2>&1 | grep -v "no lint errors found"
    fixture:
      content: |
        apiVersion: v1
        kind: Pod
        metadata:
          name: homebrew-demo
        spec:
          securityContext:
            runAsUser: 1000
            runAsGroup: 3000
            fsGroup: 2000
          containers:
          - name: homebrew-test
            image: busybox:stable
            resources:
              limits:
                memory: "128Mi"
                cpu: "500m"
              requests:
                memory: "64Mi"
                cpu: "250m"
            securityContext:
              readOnlyRootFilesystem: true
      extname: yaml
