forked from pixie-io/pixie
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from bazel define flags to skylib flags
Summary: We used --define to set the image versions and we explicitly created targets for every version of the image push we needed. Instead switch to skylib string_flags with TemplateVariableInfo and BuildSettingInfo to parse the command line flags, with reasonable defaults and use those to provide ctx vars that will be Make variable substituted by the container_bundle rules. Test Plan: Build the container_push scripts with various flag settings and checked the generated shell scripts. The image locations were as expected. Also built the yamls to ensure that the kustomize replacements are working as intended. Reviewers: jamesbartlett, zasgar, michelle Reviewed By: jamesbartlett Signed-off-by: Vihang Mehta <vihang@pixielabs.ai> Differential Revision: https://phab.corp.pixielabs.ai/D12883 GitOrigin-RevId: 7dad1d2d696d1ed603e68f7b14048c0a7bbc9efa
- Loading branch information
1 parent
f9c6e19
commit 71f10f3
Showing
9 changed files
with
275 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2018- The Pixie Authors. | ||
# | ||
# 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. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
load("@bazel_skylib//rules:common_settings.bzl", "string_flag") | ||
load("//bazel:images.bzl", "DEV_PREFIX", "PROPRIETARY_PREFIX", "PUBLIC_PREFIX", "bundle_version_provider", "image_prefix_provider") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
string_flag( | ||
name = "image_version", | ||
build_setting_default = "latest", | ||
) | ||
|
||
string_flag( | ||
name = "build_type", | ||
build_setting_default = "dev", | ||
values = [ | ||
"public", | ||
"proprietary", | ||
"dev", | ||
], | ||
) | ||
|
||
config_setting( | ||
name = "dev", | ||
flag_values = { | ||
":build_type": "dev", | ||
}, | ||
) | ||
|
||
config_setting( | ||
name = "public", | ||
flag_values = { | ||
":build_type": "public", | ||
}, | ||
) | ||
|
||
config_setting( | ||
name = "proprietary", | ||
flag_values = { | ||
":build_type": "proprietary", | ||
}, | ||
) | ||
|
||
bundle_version_provider( | ||
name = "bundle_version", | ||
) | ||
|
||
image_prefix_provider( | ||
name = "image_prefix", | ||
image_prefix = select({ | ||
":dev": DEV_PREFIX, | ||
":proprietary": PROPRIETARY_PREFIX, | ||
":public": PUBLIC_PREFIX, | ||
"//conditions:default": DEV_PREFIX, | ||
}), | ||
) |
Oops, something went wrong.