Created
April 23, 2019 13:29
-
-
Save medwig/de8f0fbd071e88feaa38e75e8cf87a5b to your computer and use it in GitHub Desktop.
Repair symlinks in AWS codepipeline
This file contains hidden or 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
version: 0.2 | |
phases: | |
pre_build: | |
commands: | |
# Hack to fix the symlinks that Codepipeline breaks | |
# Applies to .tf files that contain only 1 line | |
- for file in *.tf ; do awk 'NR==2{exit}END{exit NR!=1}' "$file" && sh -c "cat $file | xargs -I R2 ln -sf R2 $file"; done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
years later, this is still a super helpful gist!
In my case I had many yml files in folders with various levels of nesting that all needed to be symlinked. I ran into issues using glob patterns so i switched it out for
find
: