Skip to content

Commit

Permalink
Merge pull request #68 from moulalis/z-stream-workflow
Browse files Browse the repository at this point in the history
updating z stream rhoai
  • Loading branch information
moulalis authored May 21, 2024
2 parents 100841e + c5bc8e6 commit 37a7d3b
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 31 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/rhods-disconnected-install-helper-z-stream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ on:
repositories:
type: string
description: "Enter z-stream version (rhoai-x.y.z)"

required: true

jobs:
run-script:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run rhoai-disconnected-helper-z-stream.sh script
run: |
chmod +x rhoai-disconnected-helper-z-stream.sh
chmod +x rhoai-dih.sh
./rhoai-disconnected-helper-z-stream.sh "${{ github.event.inputs.input_variable1 }}"
- uses: actions/checkout@v3

- name: Run rhoai-disconnected-helper-z-stream.sh script
run: |
chmod +x rhoai-disconnected-helper-z-stream.sh
chmod +x rhoai-dih.sh
trimmed_version=$(./rhoai-disconnected-helper-z-stream.sh "${{ github.event.inputs.repositories }}")
echo "Trimmed Version: $trimmed_version"
shell: bash

shell: bash
- name: Commit and push changes to main branch
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
message: "Update rhoai-disconnected-helper.sh script"
repository: red-hat-data-services/rhoai-disconnected-install-helper
- name: Commit and push changes to main branch
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
message: "Update rhoai-disconnected-helper-z-stream.sh script"
repository: red-hat-data-services/rhoai-disconnected-install-helper
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ Example:
./rhoai-disconnected-helper.sh -v rhoai-1.31
```

Get a z-stream rhoai version:
```bash
./rhoai-disconnected-helper-z-stream.sh <rhoai-x.y.z>
```

Example:
```bash
./rhoai-disconnected-helper-z-stream.sh rhoai-2.9.1
```

To get help about the script
```bash
./rhoai-disconnected-helper.sh -h
Expand Down
3 changes: 2 additions & 1 deletion rhoai-dih.sh
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ function branch_exists() {
function clone_repo() {
local repo=$1
local version=$2
echo "cloning $repo with version $version"
git clone --depth 1 -b "$version" "https://github.com/red-hat-data-services/$repo.git" "$repository_folder/$repo"
if [ $? -ne 0 ]; then
echo "Error: Failed to access $repo"
Expand Down Expand Up @@ -391,7 +392,7 @@ parse_args() {
help
exit
;;
--rhods-version | -v)
--rhoai-version | -v)
rhods_version="$2"
file_name="$rhods_version.md"
shift
Expand Down
31 changes: 16 additions & 15 deletions rhoai-disconnected-helper-z-stream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,30 @@
source rhoai-dih.sh

function main(){
# echo "Enter branch name (rhoai-x.y):"
# read branch_name

# echo "Enter z-stream version (rhoai-x.y.z):"
# read rhoai_version
#branch_name=$1
rhoai_version=$1





branch_main=""
rhods_version=""
branch_main=""

set_defaults

if [ -z "$rhoai_version" ]; then
trimmed_version=$(echo "$rhoai_version" | sed 's/rhoai-\([0-9]*\.[0-9]*\)\.[0-9]*/rhoai-\1/')
rhods_version="$trimmed_version"
echo "No version provided"
exit 1
fi
# Validate the version string against the pattern x.y.z
if [[ ! "$rhoai_version" =~ ^rhoai-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. Expected format: rhoai-x.y.z"
exit 1
fi
if [ -z "$rhods_version" ]; then
rhods_version=$(echo "$rhoai_version" | sed 's/rhoai-\([0-9]*\.[0-9]*\)\.[0-9]*/rhoai-\1/')

file_name="$rhoai_version.md"
echo "Use latest RHODS version $rhods_version"
echo "File Name $file_name"
fi
if is_rhods_version_greater_or_equal_to rhods-2.4; then
echo "Cloning repositories"
echo "Cloning repositories"q
clone_all_repos
else
fetch_repository
Expand Down

0 comments on commit 37a7d3b

Please sign in to comment.