Commit ed840b81 authored by Vadim Vlasov's avatar Vadim Vlasov

fix(appgate): send org-key uploads with app_id to the org endpoint

After a 409 the server asks to retry with app_id, but a non-empty
app_id switched the plugin to the per-app endpoint, which rejects agk_
keys with 403. An agk_ key now always goes to POST /api/releases and
passes app_id in the body when set.
Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parent b94c88fe
......@@ -23,7 +23,8 @@ module Fastlane
branch = ""
end
if app_id.nil? || app_id.to_s.strip.empty?
# Org keys only work on the org endpoint, which also takes app_id to pick among same-bundle apps.
if api_key.to_s.start_with?("agk_") || app_id.nil? || app_id.to_s.strip.empty?
release_data = create_org_release(params, branch)
else
UI.message("Starting release upload...")
......@@ -93,6 +94,8 @@ module Fastlane
version = params[:version]
build_number = params[:build_number]
app_name = params[:app_name]
app_id = params[:app_id].to_s.strip
body[:app_id] = app_id unless app_id.empty?
body[:version] = version if version && !version.empty?
body[:build_number] = build_number if build_number && !build_number.empty?
body[:app_name] = app_name if app_name && !app_name.to_s.strip.empty?
......@@ -131,7 +134,7 @@ module Fastlane
[
FastlaneCore::ConfigItem.new(key: :app_id,
env_name: "APPGATE_APP_ID",
description: "AppGate App ID. Set it to upload with the app's own API key. Leave it empty to upload with an organization API key (agk_...): the app is then found or created by bundle id and platform. With an org key, set it only to pick one of several apps that share the bundle id",
description: "AppGate App ID. Required with an app's own API key. With an organization API key (agk_...) leave it empty to find or create the app by bundle id and platform, or set it to pick one of several apps that share the bundle id",
optional: true,
default_value: ""),
FastlaneCore::ConfigItem.new(key: :file_path,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment