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 de45061 commit b03939a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 28 deletions.
55 changes: 37 additions & 18 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,59 @@
# Repository Sync Script

This script automates the process of committing and pushing changes across multiple image pipeline repositories.
This Python script automates the process of syncing (pulling and pushing) changes across multiple image pipeline repositories.

## Usage

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

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
1. Pull latest changes from both 'hpw' and 'origin' remotes for each repository
2. Look for local changes in each repository
3. If changes exist, commit them with predefined messages
4. Always attempt to push to both 'hpw' and 'origin' remotes (even if there are no local changes)

This ensures that:
- Local changes are committed and pushed
- Remote changes are pulled down
- Local branch stays in sync with both remotes
- Changes from one remote are propagated to the other

## Prerequisites

- Python 3.6+
- 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"
)
## Modifying Repository Configuration

To update the repositories and their commit messages, edit the `REPOS` dictionary in the script:

```python
REPOS = {
"aws-image-pipeline": {
"message": "your commit message here",
"branch": "main"
},
"image-pipeline-ansible-playbooks": {
"message": "your commit message here",
"branch": "main"
},
"linux-image-pipeline": {
"message": "your commit message here",
"branch": "main"
}
}
```

## Error Handling

The script will:
- Continue even if one repository fails
- Report failures to push to either remote
- Skip repositories with no changes
- Continue processing even if one repository fails
- Report failures for both pull and push operations
- Skip repositories with no changes
- Exit with status code 1 if any repository fails to process
- Provide detailed error messages from git operations
20 changes: 10 additions & 10 deletions scripts/sync-repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@ def sync_repo(repo_name: str, config: dict) -> bool:
print(f"Error committing changes: {err}")
return False

# Push to both remotes
for remote in ["hpw", "origin"]:
print(f"Pushing to {remote}...")
code, out, err = run_command(
["git", "push", remote, config["branch"]],
repo_path
)
if code != 0:
# Always try to push to both remotes, even if no local changes
for remote in ["hpw", "origin"]:
print(f"Pushing to {remote}...")
code, out, err = run_command(
["git", "push", remote, config["branch"]],
repo_path
)
if code != 0:
# Only warn if the error indicates nothing to push
if "Everything up-to-date" not in err:
print(f"Warning: Failed to push to {remote}")
print(f"Error: {err}")
else:
print(f"No changes to commit in {repo_name}")

return True

Expand Down

0 comments on commit b03939a

Please sign in to comment.