diff --git a/src/Appwrite/Deployment/Deployments.php b/src/Appwrite/Deployment/Deployments.php index 094f491593..4d234fe153 100644 --- a/src/Appwrite/Deployment/Deployments.php +++ b/src/Appwrite/Deployment/Deployments.php @@ -118,13 +118,18 @@ readonly class Deployments * Same as createFromUpload(), but builds from a remote tarball at $url * (a VCS presigned URL) instead of the deployment's own uploaded source. */ + /** + * @param array $headers Sent with the source fetch, for a + * url whose provider authenticates by header + */ public function createFromUrl( Document $resource, Document $deployment, string $url, string $rootDirectory = '', + array $headers = [], ): Document { - return $this->submit($resource, $deployment, ['url' => $url, 'subdir' => $rootDirectory]); + return $this->submit($resource, $deployment, ['url' => $url, 'subdir' => $rootDirectory, 'headers' => $headers]); } private function submit(Document $resource, Document $deployment, ?array $source): Document @@ -322,7 +327,7 @@ readonly class Deployments if ($source !== null) { $subdir = \trim($source['subdir'] ?? '', '/'); $sourceArtifacts = [ - new DownloadArtifact(id: 'source', in: $source['url'], out: 'source.tar.gz'), + new DownloadArtifact(id: 'source', in: $source['url'], out: 'source.tar.gz', headers: $source['headers'] ?? []), new UnarchiveArtifact(id: 'extract', in: 'source.tar.gz', out: 'source', subdir: $subdir !== '' ? $subdir : null, strip: true, depends: 'source'), // Appwrite never sees the remote source (the sidecar fetches it), // so unlike the uploaded-tarball path it can't size it. Stat the diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php index d38efa41f1..77fae4af98 100644 --- a/src/Appwrite/Platform/Modules/Compute/Base.php +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -177,6 +177,7 @@ class Base extends Action $deployment, $vcs->getRepositoryPresignedUrl($owner, $repositoryName, $ref), $function->getAttribute('providerRootDirectory', ''), + $vcs->getRepositoryPresignedUrlHeaders(), ); } else { $deployment = $dbForProject->createDocument('deployments', new Document([ @@ -398,6 +399,7 @@ class Base extends Action $deployment, $vcs->getRepositoryPresignedUrl($owner, $repositoryName, $ref), $site->getAttribute('providerRootDirectory', ''), + $vcs->getRepositoryPresignedUrlHeaders(), ); } else { $publisherForBuilds->enqueue(new BuildMessage( diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php index efe6a8ed36..55616a18b7 100644 --- a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -162,6 +162,7 @@ class Create extends Action $deployment, $github->getRepositoryPresignedUrl($owner, $repository, $ref), $deployment->getAttribute('providerRootDirectory', ''), + $github->getRepositoryPresignedUrlHeaders(), ); } else { // Public template repo: providerBranch holds the resolved ref, diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php index 6134155a9b..776f0adae6 100644 --- a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -406,6 +406,7 @@ class Builds extends Action $deployment, $providerAdapter->getRepositoryPresignedUrl($cloneOwner, $cloneRepository, $ref), $resource->getAttribute('providerRootDirectory', ''), + $providerAdapter->getRepositoryPresignedUrlHeaders(), ); Console::execute('rm -rf ' . \escapeshellarg('/tmp/builds/' . $deploymentId), '', $stdout, $stderr); diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php index 6fcd812ac6..f0d5755c24 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -183,6 +183,7 @@ class Create extends Action $deployment, $vcs->getRepositoryPresignedUrl($owner, $repository, $ref), $deployment->getAttribute('providerRootDirectory', ''), + $vcs->getRepositoryPresignedUrlHeaders(), ); } else { // Public template repo: providerBranch holds the resolved ref, diff --git a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php index e2d87dea34..82aead9307 100644 --- a/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php +++ b/src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php @@ -397,6 +397,7 @@ trait Deployment $deployment, $vcs->getRepositoryPresignedUrl($providerRepositoryOwner, $providerRepositoryName, $providerCommitHash), $resource->getAttribute('providerRootDirectory', ''), + $vcs->getRepositoryPresignedUrlHeaders(), )); if ($resource->getCollection() === 'sites') {