private-pool/cloudbuild.yaml (21 lines of code) (raw):
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# [START cloudbuild_private_pools_tutorial]
# [START cloudbuild_private_curl]
steps:
- id: Get Private Artifactory Address
name: gcr.io/cloud-builders/gcloud
entrypoint: /bin/bash
args:
- -c
- |
gcloud compute instances describe jfrog \
--zone us-central1-a \
--format="value(networkInterfaces.networkIP)" >> _INTERNAL_IP_ADDRESS
- id: Pull from Private Artifactory
name: gcr.io/cloud-builders/curl
entrypoint: /bin/bash
args:
- -c
- |
curl -u admin:password --connect-timeout 10.00 \
http://$(cat _INTERNAL_IP_ADDRESS):8081/artifactory/example-repo-local/helloworld.txt
# [END cloudbuild_private_curl]
# [START cloudbuild_private_worker_pool]
options:
pool:
name: 'projects/${PROJECT_ID}/locations/us-central1/workerPools/jfrog-pool'
# [END cloudbuild_private_worker_pool]
# [END cloudbuild_private_pools_tutorial]