Docs: "alternative to CI/CD file variables" provides bad example
The CI/CD variable types documentation includes the following section, which provides example code which is broken.
An alternative to
File
type variables is to:
- Read the value of a CI/CD variable (
variable
type).- Save the value in a file.
- Use that file in your script.
# Read certificate stored in $KUBE_CA_PEM variable and save it in a new file cat "$KUBE_CA_PEM" > "$(pwd)/kube.ca.pem" # Pass the newly created file to kubectl kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$(pwd)/kube.ca.pem"
Because KUBE_CA_PEM
in this example is a variable
type of CI/CD variable, the operation applied should be echo
, not cat
.
# Read certificate stored in $KUBE_CA_PEM variable and save it in a new file
echo "$KUBE_CA_PEM" > "$(pwd)/kube.ca.pem"
# Pass the newly created file to kubectl
kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$(pwd)/kube.ca.pem"