Créer des dépôts à partir de Bitbucket Server dans un réseau privé
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cloud Build vous permet de créer des déclencheurs pour compiler à partir de dépôts hébergés sur Bitbucket Server. Vous pouvez ainsi exécuter des compilations en réponse à des événements tels que des requêtes push de commit ou des demandes d'extraction associées à votre dépôt Bitbucket Server.
Cette page explique comment activer la fonctionnalité de déclencheur sur une instance Bitbucket Server si elle est hébergée dans un réseau privé.
Avant de commencer
Enable the Cloud Build, Secret Manager, Compute Engine, and Service Networking APIs.
Si vous n'avez pas encore créé de pool privé, suivez les instructions de la page Créer et gérer des pools privés. Vous aurez besoin d'un pool privé pour compiler dans un réseau privé.
Créer des dépôts depuis Bitbucket Server dans un réseau privé
Si votre instance Bitbucket Server est hébergée dans un réseau privé et n'est pas accessible via une connexion Internet publique, vous devez créer une connexion privée entre votre réseau VPC et le réseau de producteurs de services. Vous avez également besoin d'un pool privé pour compiler dans un réseau privé.
Pour créer un déclencheur Bitbucket Server afin de compiler dans un réseau privé :
Créez une connexion privée entre le réseau VPC et votre réseau de producteur de services en procédant comme suit :
Pour utiliser le réseau VPC avec Cloud Build, la longueur de votre préfixe doit être de /23 ou moins, telle que /22 ou /21. Cela permet d'accueillir au minimum vos déclencheurs et vos pools de nœuds de calcul, car chaque connexion de service tente de revendiquer une plage d'adresses IP avec une longueur de préfixe de /24.
Vous pouvez spécifier la plage à l'aide de la notation CIDR (Classless Inter-Domain Routing) au format STARTING_IP/SUBNET_PREFIX_SIZE. Par exemple, 192.0.2.0/24 a une longueur de préfixe de 24. Les 24 premiers bits de la plage d'adresses IP sont utilisés comme masque de sous-réseau (192.0.2.0), tandis que les adresses d'hôte possibles vont de 192.0.2.0 à 192.0.2.255.
Établissez une connexion privée de réseau VPC entre votre réseau VPC et Google Cloud. Pour en savoir plus, consultez Créer une connexion privée.
[FACULTATIF] Si vous ne souhaitez pas créer de connexion privée depuis votre projet Cloud, vous pouvez configurer un VPC partagé et faire en sorte que votre projet Cloud utilise ce réseau si votre projet fait partie d'une organisation. Vous aurez tout de même besoin que le VPC partagé soit appairé au réseau.
Utilisez des pools privés pour exécuter vos compilations. Si vous n'avez pas créé de pool privé, consultez Créer un pool privé.
Votre déclencheur Bitbucket Server appelle désormais automatiquement les compilations sur votre instance Bitbucket Server en fonction de votre configuration. Pour savoir comment exécuter des compilations à l'aide d'un pool privé, consultez la section Exécuter des compilations dans un pool privé.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eCloud Build triggers can be set up to initiate builds from Bitbucket Server repositories in response to events like commit pushes or pull requests.\u003c/p\u003e\n"],["\u003cp\u003eFor Bitbucket Server instances within a private network, a private connection between the VPC network and the service producer network is required.\u003c/p\u003e\n"],["\u003cp\u003eBuilding in a private network necessitates the use of a private pool, which needs to be created if not already present.\u003c/p\u003e\n"],["\u003cp\u003eCreating a private connection involves setting up a VPC network, allocating internal and named IP ranges, and establishing the connection between your VPC and Google Cloud.\u003c/p\u003e\n"],["\u003cp\u003eBitbucket Server triggers can be established by connecting a Bitbucket Server host, connecting the repository, and then creating the trigger.\u003c/p\u003e\n"]]],[],null,["# Build repositories from Bitbucket Server in a private network\n\nCloud Build enables you to create triggers to build from\nrepositories hosted on [Bitbucket Server](https://confluence.atlassian.com/bitbucketserver/bitbucket-data-center-and-server-documentation-776639749.html), allowing you to execute builds\nin response to events such as commit pushes or pull requests associated with your Bitbucket Server repository.\n\nThis page explains how you can enable trigger functionality on a\nBitbucket Server instance if your instance is hosted in a private network.\n\nBefore you begin\n----------------\n\n-\n\n\n Enable the Cloud Build, Secret Manager, Compute Engine, and Service Networking APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com,secretmanager.googleapis.com,compute.googleapis.com,servicenetworking.googleapis.com&redirect=https://cloud.google.com/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server-private-network)\n\n\u003c!-- --\u003e\n\n- If you have not created a private pool, follow the instructions in [Create and manage private pools](/build/docs/private-pools/create-manage-private-pools) to create a private pool. You will need a private pool to build in a private network.\n\nBuilding repositories from Bitbucket Server in a private network\n----------------------------------------------------------------\n\nIf your Bitbucket Server instance is hosted in a private network\nand not reachable over a public internet connection,\nyou must create a private connection between\nyour VPC\nnetwork and the [service producer network](/../vpc/docs/private-services-access#service_producer_network). You\nalso need a [private pool](/build/docs/private-pools/private-pools-overview) to build in a private network.\n\nTo create a Bitbucket Server trigger to build in a private network:\n\n1. Create a private connection between the VPC network\n and your service producer network by completing the following steps:\n\n 1. [Create a new VPC network](/../vpc/docs/create-modify-vpc-networks#create-custom-network) or [select an existing VPC network](https://console.cloud.google.com/networking/networks/list).\n\n | **Note:** You must configure your VPC network to have access to your Bitbucket Server instance in a private network.\n 2. [Allocate a named IP range in the VPC network](/vpc/docs/configure-private-services-access#allocating-range) for your peered network.\n\n 3. [Allocate an internal IP range in the VPC](/vpc/docs/configure-private-services-access#allocating-range) that the Cloud Build\n producer network can use to allocate to VMs maintaining a connection\n with private repositories.\n\n To use the VPC network with Cloud Build, your\n prefix length must be `/23` or lower, such as `/22` or `/21`. This is to\n accommodate, at a minimum, both your triggers and your worker pools,\n because each service connection tries to claim an IP range with a prefix\n length of `/24`.\n\n You can specify the range using the Classless Inter-Domain Routing (CIDR)\n routing notation in the format `STARTING_IP/SUBNET_PREFIX_SIZE`. For example,\n `192.0.2.0/24` has a prefix length of 24. The first 24 bits of the IP range\n are used as the subnet mask (`192.0.2.0`) while the possible hosts addresses\n range from `192.0.2.0` to `192.0.2.255`.\n | **Note:** The value of your prefix length must not exceed `/29`. If no value is specified for the range, a default value of `/24` is automatically assigned. If no value is specified for the prefix length, IP addresses are automatically assigned within the peered VPC network.\n 4. Establish a VPC network private connection between your VPC network and Google Cloud. To learn more, see [Creating a private connection](/../vpc/docs/configure-private-services-access#creating-connection).\n\n 5. If you have DNS configured for your Bitbucket Server instance, you need to manually peer your DNS zone to our service provider. To learn\n more, see the [Sharing private DNS zones with service producers](/../vpc/docs/configure-private-services-access#dns-peering).\n\n 6. \\[OPTIONAL\\] If you do not want to create a private connection from your Cloud project,\n you can set up a [Shared VPC](/../vpc/docs/provisioning-shared-vpc) and have your Cloud project use that network instead if your project is part of an organization. You will still need the Shared VPC to be peered to the network.\n\n2. Use [private pools](/build/docs/private-pools/private-pools-overview)\n to run your builds. If you have not created a private pool,\n see [create a new private pool](/build/docs/private-pools/create-manage-private-pools).\n\n3. [Connect a Bitbucket Server host](/build/docs/automating-builds/bitbucket/connect-host-bitbucket-server).\n\n4. [Connect a Bitbucket Server repository](/build/docs/automating-builds/bitbucket/connect-repo-bitbucket-server).\n\n5. [Create a Bitbucket Server trigger](/build/docs/automating-builds/bitbucket/build-repos-from-bitbucket-server)\n to build repositories hosted on a Bitbucket Server instance.\n\nYour Bitbucket Server trigger will now automatically invoke builds on\nyour Bitbucket Server instance based on your configuration. To learn how to run builds using a private pool, see [Running builds in a private pool](/build/docs/private-pools/run-builds-in-private-pool).\n\nWhat's next\n-----------\n\n- Learn how to [create and manage build triggers](/build/docs/automating-builds/create-manage-triggers).\n- Learn how to [perform blue/green deployments on Compute Engine](/build/docs/deploying-builds/deploy-compute-engine)."]]