Skip to content
Merged
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
35 changes: 31 additions & 4 deletions .github/scripts/update-updater-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,12 @@ ${NEW_SIG_BLOCK}
SCENARIO

# Update latest.feature
# Find current latest stable version and replace
# Find current latest stable version and replace.
# head -1: latest.feature may hold several "latest stable" scenarios
# (e.g. a PHP-version-pinned one); only the first is the primary entry.
# Without it the var goes multiline and breaks the sed below.
CURRENT_LATEST_STABLE=$(grep -A4 'latest stable release' "$LATEST_FEATURE" \
| grep 'Version "' | grep -oP 'Version "\K[^"]+')
| grep 'Version "' | grep -oP 'Version "\K[^"]+' | head -1)
CURRENT_LATEST_STABLE_URL=$(echo "$CURRENT_LATEST_STABLE" | sed 's/ //g' | tr '[:upper:]' '[:lower:]')

if [[ -n "$CURRENT_LATEST_STABLE" ]]; then
Expand Down Expand Up @@ -541,8 +544,9 @@ ${NEW_SIG_BLOCK}
SCENARIO

# Update latest.feature — beta now points to this pre-release
# head -1: see CURRENT_LATEST_STABLE note — guard against multiline.
CURRENT_LATEST_BETA=$(grep -A4 'latest beta release' "$LATEST_FEATURE" \
| grep 'Version "' | grep -oP 'Version "\K[^"]+')
| grep 'Version "' | grep -oP 'Version "\K[^"]+' | head -1)
CURRENT_LATEST_BETA_URL=$(echo "$CURRENT_LATEST_BETA" | sed 's/ //g' | tr '[:upper:]' '[:lower:]')

if [[ -n "$CURRENT_LATEST_BETA" ]]; then
Expand Down Expand Up @@ -582,10 +586,32 @@ if [[ "$DEPLOY" -ne 100 ]]; then
COMMIT_MSG="${COMMIT_MSG} (${DEPLOY}% rollout)"
fi

# Ensure a git identity exists (CI runners have none by default).
# Derive it from the token owner (GH_TOKEN == RELEASE_TOKEN) so commits
# are authored by the bot the token belongs to. Fall back to
# github-actions[bot] if the token isn't a user token (e.g. github.token).
if [[ -z "$(git config user.email)" ]]; then
BOT_LOGIN=$(gh api user --jq '.login' 2>/dev/null || true)
if [[ -n "$BOT_LOGIN" ]]; then
BOT_ID=$(gh api user --jq '.id' 2>/dev/null || true)
git config user.name "$BOT_LOGIN"
git config user.email "${BOT_ID}+${BOT_LOGIN}@users.noreply.github.com"
else
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
fi
fi

git checkout -b "$BRANCH"
git add config/ tests/
git commit --signoff -m "$COMMIT_MSG"
git push -u origin "$BRANCH"

# Route git's github.com auth through gh (GH_TOKEN == RELEASE_TOKEN);
# the gh-cloned remote has no push credentials on its own.
gh auth setup-git
# Force-push so re-runs for the same release overwrite a stale branch
# (each run produces a fresh commit, so a leftover branch is non-ff).
git push --force -u origin "$BRANCH"

BODY="Automated PR from the release pipeline.

Expand All @@ -599,6 +625,7 @@ Generated by \`update-updater-server.sh ${TAG}\`."
gh pr create \
--repo "$UPDATER_REPO" \
--base master \
--head "$BRANCH" \
--title "$COMMIT_MSG" \
--body "$BODY"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "34.0.0 RC5" is the latest release
And URL to download is "https://download.nextcloud.com/server/prereleases/nextcloud-34.0.0rc5.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "35.0.0 beta 1" is the latest release
And URL to download is "https://download.nextcloud.com/server/prereleases/nextcloud-35.0.0beta1.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "34.0.0" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-34.0.0.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "34.0.0 RC5" is the latest release
And URL to download is "https://download.nextcloud.com/server/prereleases/nextcloud-34.0.0rc5.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "34.0.0 RC5" is the latest release
And URL to download is "https://download.nextcloud.com/server/prereleases/nextcloud-34.0.0rc5.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "34.0.0 RC5" is the latest release
And URL to download is "https://download.nextcloud.com/server/prereleases/nextcloud-34.0.0rc5.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,32 @@ Feature: Testing the latest endpoint
Then The JSON response is non-empty
And Version "34.0.0 RC6" is the latest release
And URL to download is "https://download.nextcloud.com/server/prereleases/nextcloud-34.0.0rc6.zip"

Scenario: Get latest stable version with PHP 8.0
Given I want to know the latest stable release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest beta version with PHP 8.0
Given I want to know the latest beta release
And I use PHP "8.0"
When I send a request latest.php
Then The JSON response is non-empty
And Version "29.0.16" is the latest release
And URL to download is "https://download.nextcloud.com/server/releases/nextcloud-29.0.16.zip"

Scenario: Get latest version with invalid PHP version
Given I want to know the latest beta release
And I use PHP "test"
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid PHP version provided"

Scenario: Get latest version with invalid channel
Given I want to know the latest whatever release
When I send a request latest.php
Then The JSON response is non-empty
And I get error "Invalid channel provided"
Loading