Skip to content

Commit

Permalink
try using find over looping
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisonB319 committed Nov 8, 2024
1 parent a6c3cf5 commit 8567347
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions .pipelines/.vsts-vhd-builder-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1339,34 +1339,19 @@ stages:
mkdir -p $(Pipeline.Workspace)/consolidated-artifacts
echo "Workspace: $(Pipeline.Workspace)"
echo "Looking into: $(Pipeline.Workspace)"
directory_contents=$(ls -l $(Pipeline.Workspace)/)
echo "$directory_contents"
for dir in $(Pipeline.Workspace)/*; do
if [ -d "$dir" ]; then
echo "Processing directory: $dir"
# Check if the directory name is not a publishing-info directory
if [[ $(basename "$dir") != publishing-info-* ]]; then
echo "Directory $(basename "$dir") is not a publishing-info directory"
# Check if the vhd-publishing-info.json file exists in this directory
if [ -f "$dir/vhd-publishing-info.json" ]; then
echo "Found vhd-publishing-info.json in $dir"
cp "$dir/vhd-publishing-info.json" "$(Pipeline.Workspace)/consolidated-artifacts/vhd-publishing-info-$(basename "$dir").json"
echo "Copied vhd-publishing-info.json to $(Pipeline.Workspace)/consolidated-artifacts/vhd-publishing-info-$(basename "$dir").json"
else
echo "No vhd-publishing-info.json found in $dir"
fi
else
echo "Skipping publishing-info directory: $(basename "$dir")"
fi
else
echo "$dir is not a directory, skipping."
fi
# Search for all vhd-publishing-info.json files under the workspace recursively
find $(Pipeline.Workspace) -type f -name "vhd-publishing-info.json" ! -path "*/publishing-info/*" | while read filepath; do
dir=$(dirname "$filepath")
base_dir=$(basename "$dir")
echo "Found vhd-publishing-info.json in $dir"
cp "$filepath" "$(Pipeline.Workspace)/consolidated-artifacts/vhd-publishing-info-$base_dir.json"
echo "Copied $filepath to $(Pipeline.Workspace)/consolidated-artifacts/vhd-publishing-info-$base_dir.json"
done
directory_contents=$(ls -l $(Pipeline.Workspace)/)
# List the contents of the consolidated artifacts directory
directory_contents=$(ls -l $(Pipeline.Workspace)/consolidated-artifacts)
echo "$directory_contents"
displayName: Move VHD publishing info to a consolidated folder
- bash: bash .pipelines/scripts/setup_go.sh
Expand Down

0 comments on commit 8567347

Please sign in to comment.