Skip to content

Commit

Permalink
fix: update morpheus module config to use proper device mappings for …
Browse files Browse the repository at this point in the history
…NVMe EBS volumes
  • Loading branch information
arnol377 committed Feb 12, 2025
1 parent fb870ac commit 1c24ab7
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
40 changes: 40 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Repository Sync Script

This script automates the process of committing and pushing changes across multiple image pipeline repositories.

## Usage

```bash
./scripts/sync-repos.sh
```

The script will:
1. Look for changes in each repository
2. Commit changes with predefined commit messages
3. Push to both 'hpw' and 'origin' remotes

## Prerequisites

- Git repositories must be cloned in the same parent directory
- Both 'hpw' and 'origin' remotes must be configured
- Script must be run from the aws-image-pipeline directory
- Appropriate git credentials/SSH keys must be configured

## Modifying Commit Messages

To update the commit messages, edit the `REPOS` array in the script. Each repository has an associated commit message:

```bash
declare -A REPOS=(
["aws-image-pipeline"]="your commit message here"
["image-pipeline-ansible-playbooks"]="your commit message here"
["linux-image-pipeline"]="your commit message here"
)
```

## Error Handling

The script will:
- Continue even if one repository fails
- Report failures to push to either remote
- Skip repositories with no changes
51 changes: 51 additions & 0 deletions scripts/sync-repos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -e

# Directory containing all repos
BASE_DIR=/home/a/arnol377/git

# Define repositories and their commit messages
declare -A REPOS
REPOS["aws-image-pipeline"]="fix: update morpheus module config to use proper device mappings for NVMe EBS volumes"
REPOS["image-pipeline-ansible-playbooks"]="fix: update volume mounting to handle NVMe device mapping and add enhanced error checking"
REPOS["linux-image-pipeline"]="fix: update packer configuration to properly handle root volume and NVMe device mappings"

# Function to commit and push changes
commit_and_push() {
local repo=$1
local message=$2
local dir="${BASE_DIR}/${repo}"

echo "Processing ${repo}..."

if [ ! -d "$dir" ]; then
echo "Error: Directory $dir does not exist"
return 1
fi

cd "$dir"

# Check if there are changes to commit
if git status --porcelain | grep -q '^'; then
echo "Changes detected in ${repo}, committing..."
git add .
git commit -m "$message"

# Push to both remotes
echo "Pushing to hpw..."
git push hpw main || echo "Warning: Failed to push to hpw remote"

echo "Pushing to origin..."
git push origin main || echo "Warning: Failed to push to origin remote"
else
echo "No changes to commit in ${repo}"
fi
}

# Main execution
for repo in "${!REPOS[@]}"; do
commit_message=${REPOS[$repo]}
commit_and_push "$repo" "$commit_message" || echo "Failed to process ${repo}"
done

echo "All repositories processed successfully!"

0 comments on commit 1c24ab7

Please sign in to comment.