Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enables the full cosmo docker example to be built upon the latest rel… #1354

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/full-cosmo-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This example demonstrates how to run the entire Cosmo platform locally with Dock
1. Start the platform:

```shell
./start.sh
./start.sh --last-release
```

2. Navigate to the [Studio Playground](http://localhost:3000/wundergraph/default/graph/mygraph/playground) and login before with the default credentials:
Expand All @@ -43,4 +43,4 @@ query MyEmployees {
}
```

After you are done, you can clean up the demo by running `./destroy.sh`.
After you are done, you can clean up the demo by running `./destroy.sh --last-release`.
13 changes: 12 additions & 1 deletion examples/full-cosmo-docker/destroy.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
#!/bin/bash
set -e

cd ../.. && make full-demo-down
file_path="current_commit.hash"
if [[ "$1" == "--last-release" ]] && [ -f "$file_path" ]; then
current_commit=$(cat "$file_path") # Use $file variable here
rm -f "$file_path"
fi

cd ../.. && make full-demo-down

if [[ "$1" == "--last-release" ]] && (( ${#current_commit} > 0 )); then
# Restoring code: Checkout to the current commit
git checkout "$current_commit"
fi
14 changes: 14 additions & 0 deletions examples/full-cosmo-docker/start.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
#!/bin/bash
set -e

file_path="current_commit.hash"
if [[ "$1" == "--last-release" ]]; then
current_commit=$(git rev-parse HEAD)

latest_tag=$(git tag --sort=-v:refname | head -n 1)
latest_release_commit=$(git rev-list -n 1 "$latest_tag")

# Checkout the code at the last release
git checkout "$latest_release_commit"

echo $current_commit > "$file_path"
current=$(cat current_commit.hash)
fi

cd ../.. && make full-demo-up
Loading