我不知道我做错了什么。只需在我的管道上运行这个简单的 bash 脚本即可。它在本地运行良好,但在管道日志上会出现冲突。
refresh.sh
#!/bin/bash -e
# refresh.sh
# Create a kustomization.yaml and then add all kubernetes YAMLs into resources...
echo -n "
# built by ./refresh.sh
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
" > kustomization.yaml
yamls=$(find . -type f -name "*.yaml" | grep -v kustomization.yaml)
for y in ${yamls[@]}; do
kustomize edit add resource $y
done
错误:
step_script: eval: line 180: ./refresh.sh: not found
我的
.gitlab-ci.yml
image:
name: openpolicyagent/conftest:latest
stages:
- kustomize
- policy
kustomize:
stage: kustomize
script:
- echo "Running test 1..."
- chmod +x refresh.sh
- ./refresh.sh
policy:
stage: policy
script:
- echo "Running test 2"
- kubectl kustomize | conftest test -
- rm kustomization.yaml
谢谢
我会尝试这个并检查输出。可能是一些路径问题。
kustomize:
stage: kustomize
script:
- pwd # Print current working directory
- ls -la # List all files in the current directory
- echo "Running test 1..."
- chmod +x refresh.sh
- ./refresh.sh