forked from GoogleContainerTools/kpt-config-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.oss.prow
91 lines (79 loc) · 4.26 KB
/
Makefile.oss.prow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Copyright 2022 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.
# special prow related things
# Images are tagged with an arbitrary semver and git SHA. The git SHA ensures
# unique tags and makes the images traceable back to a commit. The semver should
# be revved upon any major changes to the image.
# This is the image used by the new GKE e2e jobs. This job type runs against GKE
# clusters rather than kind, so we don't need docker in docker.
# This is published automatically by postsubmit whenever an input changes.
GKE_E2E_TAG := $(INFRA_VERSION)-go$(GOLANG_IMAGE_VERSION)-gcloud$(GCLOUD_IMAGE_VERSION)-docker$(DOCKER_CLI_IMAGE_VERSION)
GKE_E2E_IMAGE := $(TEST_INFRA_REGISTRY)/gke-e2e:$(GKE_E2E_TAG)
# The gke-e2e image is also tagged with a git sha so that it can be traced
# back to commit it was built from.
GKE_E2E_SHA_IMAGE := $(TEST_INFRA_REGISTRY)/gke-e2e:$(INFRA_IMAGE_VERSION)
.PHONY: build-gke-e2e
build-gke-e2e:
@echo "+++ Building $(GKE_E2E_IMAGE)"
docker buildx build \
--target gke-e2e \
-t $(GKE_E2E_IMAGE) \
-f build/prow/e2e/Dockerfile \
$(DOCKER_BUILD_ARGS) \
.
.PHONY: push-gke-e2e
push-gke-e2e:
@docker push $(GKE_E2E_IMAGE)
@docker tag $(GKE_E2E_IMAGE) $(GKE_E2E_SHA_IMAGE)
@docker push $(GKE_E2E_SHA_IMAGE)
###################################
# Prow environment provisioning
###################################
KUSTOMIZE_COMPONENTS_PACKAGE_NAME := kustomize-components
KUSTOMIZE_COMPONENTS_DIR := e2e/testdata/hydration/$(KUSTOMIZE_COMPONENTS_PACKAGE_NAME)
# kustomize-components public images (singleton test-infra registry)
KUSTOMIZE_COMPONENTS_PUBLIC_AR_IMAGE := $(LOCATION)-docker.pkg.dev/$(TEST_INFRA_PROJECT)/config-sync-test-public/$(KUSTOMIZE_COMPONENTS_PACKAGE_NAME)
KUSTOMIZE_COMPONENTS_PUBLIC_GCR_IMAGE := gcr.io/$(TEST_INFRA_PROJECT)/$(KUSTOMIZE_COMPONENTS_PACKAGE_NAME)
# This target is run as a singleton against the ci-artifacts project, since
# these require for the registries to be public.
.PHONY: push-test-oci-images-public
push-test-oci-images-public: "$(CRANE)"
@gcloud $(GCLOUD_QUIET) auth configure-docker $(LOCATION)-docker.pkg.dev,gcr.io
cd $(KUSTOMIZE_COMPONENTS_DIR) && crane append -f <(tar -f - -c .) -t $(KUSTOMIZE_COMPONENTS_PUBLIC_GCR_IMAGE)
cd $(KUSTOMIZE_COMPONENTS_DIR) && crane append -f <(tar -f - -c .) -t $(KUSTOMIZE_COMPONENTS_PUBLIC_AR_IMAGE)
# The following targets are used to provision test resources in a prow environment
# kustomize-components private images (per dev/prow env registry)
KUSTOMIZE_COMPONENTS_PRIVATE_GCR_IMAGE := gcr.io/$(GCP_PROJECT)/config-sync-test/$(KUSTOMIZE_COMPONENTS_PACKAGE_NAME):v1
# namespace-repo private image (per dev/prow env registry)
NAMESPACE_REPO_PACKAGE_NAME := namespace-repo
NAMESPACE_REPO_DIR := e2e/testdata/hydration/$(NAMESPACE_REPO_PACKAGE_NAME)
NAMESPACE_REPO_PRIVATE_GCR_IMAGE := gcr.io/$(GCP_PROJECT)/config-sync-test/$(NAMESPACE_REPO_PACKAGE_NAME):v1
.PHONY: push-test-oci-images-private
# push-test-oci-images-private pushes the test images to the Container Registry repository.
push-test-oci-images-private: "$(CRANE)"
@gcloud $(GCLOUD_QUIET) auth configure-docker $(LOCATION)-docker.pkg.dev,gcr.io
cd $(KUSTOMIZE_COMPONENTS_DIR) && crane append -f <(tar -f - -c .) -t $(KUSTOMIZE_COMPONENTS_PRIVATE_GCR_IMAGE)
cd $(NAMESPACE_REPO_DIR) && crane append -f <(tar -f - -c .) -t $(NAMESPACE_REPO_PRIVATE_GCR_IMAGE)
.PHONY: set-up-kcc-configs
KCC_MANAGED_PROJECT ?= cs-dev-hub
set-up-kcc-configs:
GCP_PROJECT=$(GCP_PROJECT) KCC_MANAGED_PROJECT=$(KCC_MANAGED_PROJECT) \
./scripts/set-up-kcc-configs.sh
.PHONY: set-up-workload-identity-test
FLEET_HOST_PROJECT ?= cs-dev-hub
PROW_PROJECT ?= oss-prow-build-kpt-config-sync
set-up-workload-identity-test:
GCP_PROJECT=$(GCP_PROJECT) FLEET_HOST_PROJECT=$(FLEET_HOST_PROJECT) \
PROW_PROJECT=$(PROW_PROJECT) \
./scripts/set-up-workload-identity-configs.sh