Skip to content

Commit 03f7c83

Browse files
committed
add channel-create and channel-delete tasks
- channel-create: creates release channel if it doesn't exist - channel-delete: archives release channel by name - both tasks use RELEASE_CHANNEL parameter for consistency
1 parent 355b908 commit 03f7c83

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

applications/wg-easy/Taskfile.yaml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ tasks:
155155
# Find all Chart.yaml files and extract HTTP/HTTPS repositories
156156
for chart_file in $(find charts/ -maxdepth 2 -name "Chart.yaml"); do
157157
echo "Processing $chart_file"
158-
158+
159159
# Extract repository URLs that start with http:// or https://
160160
yq eval '.dependencies[]?.repository' "$chart_file" 2>/dev/null | grep -E '^https?://' | while read -r repo_url; do
161161
if [ -n "$repo_url" ]; then
162162
# Generate a repository name from the URL
163163
repo_name=$(echo "$repo_url" | sed 's|https\?://||' | sed 's|[./]|-|g' | sed 's|-*$||')
164-
164+
165165
echo "Adding repository: $repo_name -> $repo_url"
166166
helm repo add "$repo_name" "$repo_url" || echo "Repository $repo_name may already exist"
167167
fi
@@ -537,45 +537,45 @@ tasks:
537537
desc: Create a Replicated release channel
538538
silent: false
539539
vars:
540-
CHANNEL_NAME: '{{.CHANNEL_NAME}}'
540+
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL}}'
541541
requires:
542-
vars: [APP_SLUG, CHANNEL_NAME]
542+
vars: [APP_SLUG, RELEASE_CHANNEL]
543543
cmds:
544-
- echo "Creating channel {{.CHANNEL_NAME}} for app {{.APP_SLUG}}..."
544+
- echo "Creating channel {{.RELEASE_CHANNEL}} for app {{.APP_SLUG}}..."
545545
- |
546546
# Check if channel already exists
547-
EXISTING_CHANNEL=$(replicated channel ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CHANNEL_NAME}}") | .name' | head -1)
548-
547+
EXISTING_CHANNEL=$(replicated channel ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.RELEASE_CHANNEL}}") | .name' | head -1)
548+
549549
if [ -n "$EXISTING_CHANNEL" ]; then
550-
echo "Channel {{.CHANNEL_NAME}} already exists for app {{.APP_SLUG}}"
550+
echo "Channel {{.RELEASE_CHANNEL}} already exists for app {{.APP_SLUG}}"
551551
exit 0
552552
fi
553553
554554
# Create the channel
555-
replicated channel create --app {{.APP_SLUG}} --name {{.CHANNEL_NAME}}
556-
echo "Channel {{.CHANNEL_NAME}} created successfully"
555+
replicated channel create --app {{.APP_SLUG}} --name {{.RELEASE_CHANNEL}}
556+
echo "Channel {{.RELEASE_CHANNEL}} created successfully"
557557
558558
channel-delete:
559559
desc: Archive a Replicated release channel
560560
silent: false
561561
vars:
562-
CHANNEL_NAME: '{{.CHANNEL_NAME}}'
562+
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL}}'
563563
requires:
564-
vars: [APP_SLUG, CHANNEL_NAME]
564+
vars: [APP_SLUG, RELEASE_CHANNEL]
565565
cmds:
566-
- echo "Archiving channel {{.CHANNEL_NAME}} for app {{.APP_SLUG}}..."
566+
- echo "Archiving channel {{.RELEASE_CHANNEL}} for app {{.APP_SLUG}}..."
567567
- |
568568
# Get channel ID
569-
CHANNEL_ID=$(replicated channel ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.CHANNEL_NAME}}") | .id' | head -1)
570-
569+
CHANNEL_ID=$(replicated channel ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.name=="{{.RELEASE_CHANNEL}}") | .id' | head -1)
570+
571571
if [ -z "$CHANNEL_ID" ]; then
572-
echo "Error: Channel {{.CHANNEL_NAME}} not found for app {{.APP_SLUG}}"
572+
echo "Error: Channel {{.RELEASE_CHANNEL}} not found for app {{.APP_SLUG}}"
573573
exit 1
574574
fi
575575
576576
# Archive the channel
577577
replicated channel archive --app {{.APP_SLUG}} $CHANNEL_ID
578-
echo "Channel {{.CHANNEL_NAME}} (ID: $CHANNEL_ID) archived successfully"
578+
echo "Channel {{.RELEASE_CHANNEL}} (ID: $CHANNEL_ID) archived successfully"
579579
580580
clean:
581581
desc: Remove temporary Helm directories, chart dependencies, and release folder

0 commit comments

Comments
 (0)