Skip to content

Commit

Permalink
Added a hammer devel container script
Browse files Browse the repository at this point in the history
to turn on the hammer devel environment.
  • Loading branch information
parthaa committed Feb 5, 2025
1 parent 6b20038 commit f6f2790
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ hammer-cli development docs for [help](https://github.com/theforeman/hammer-cli/

## Development setup

The easiest way to set up a hammer development environment is to use the centos7-hammer-devel box in
The easiest way to set up a hammer development environment is to use the `hammer-devel-container.sh` script.
* Clone this repo.
* Run the following commands
```bash
$ cd hammer-cli-katello
$ hammer-devel-container.sh
```
This should start a container that points to your localhost foreman server

Alternately you can use the centos7-hammer-devel box in
[forklift](https://github.com/theforeman/forklift).

## Configuration
Expand Down
26 changes: 26 additions & 0 deletions hammer-devel-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#/bin/bash
shopt -s expand_aliases
#set -e
#set -x

# Check if podman is installed
if ! $(rpm -q --quiet podman) ; then
echo "Error: podman is not installed."
exit 1
fi

# Check if the HAMMER_DIR environment variable exists and is not empty
if [ -z "${HAMMER_DIR+x}" ]; then
# If the environment variable does not exist, use the current working directory
HAMMER_DIR=$(pwd)
fi

if [ ! -f "$HAMMER_DIR/hammer_cli_katello.gemspec" ]; then
# Not a hammer cli katello repo. Have the user set it and exit
echo "Error: HAMMER_DIR needs to point to a hammer-cli-katello repo"
exit 1
fi

chmod 777 $HAMMER_DIR
find $HAMMER_DIR -type d -exec chmod 777 {} +
podman run --rm -it --network=host -v $HAMMER_DIR:/opt/app-root/src/hammer-cli-katello:Z ghcr.io/katello/hammer-cli-katello-devel:latest

0 comments on commit f6f2790

Please sign in to comment.