Last active
November 23, 2021 07:49
-
-
Save Gershon-A/21412e466e9f5ef81f3c43df7d3f67da to your computer and use it in GitHub Desktop.
AWS CodeBuild grep and sed yaml file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example of replacing "tag" in helm values.yaml file in CodeBuild | |
``` | |
# VALUE for tag in values.yaml is tag: "121212" | |
# NEW_TAG = 131313 | |
# YAML_FILE = values.yaml | |
- "OLD_TAG=$(cat $YAML_FILE | grep -P 'tag:' | awk -F: '{ print $2 }' | sed 's/[\",]//g' | sed -e 's/^[[:space:]]*//')" | |
- echo OLD_TAG=$OLD_TAG | |
- sed -i "s|${OLD_TAG}|${NEW_TAG}|g" $YAML_FILE | |
- cat $YAML_FILE | grep tag | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment