forked from privacysandbox/bidding-auction-servers
-
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.
Co-authored-by: Dominic Ayre <dominicayre@microsoft.com> Co-authored-by: Joe Powell <joepowell@microsoft.com> Co-authored-by: Kapil Vaswani <kapilv@microsoft.com> Co-authored-by: Ken Gordon <Ken.Gordon@microsoft.com> Co-authored-by: Mahati Chamarthy <mahati.chamarthy@microsoft.com> Co-authored-by: Ronny Bjones <ronny.bjones@microsoft.com>
- Loading branch information
1 parent
b222e35
commit 766537f
Showing
32 changed files
with
1,248 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
# Portions Copyright (c) Microsoft Corporation | ||
# | ||
# 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. | ||
|
||
load( | ||
"@io_bazel_rules_docker//container:container.bzl", | ||
"container_image", | ||
"container_layer", | ||
) | ||
load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") | ||
load( | ||
"@rules_pkg//pkg:mappings.bzl", | ||
"pkg_attributes", | ||
"pkg_files", | ||
) | ||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar") | ||
load("@rules_pkg//pkg:zip.bzl", "pkg_zip") | ||
load("//:config.bzl", "LOG_ENV_VARS") | ||
|
||
pkg_files( | ||
name = "server_executables", | ||
srcs = [ | ||
"bin/init_server_basic", | ||
"//services/auction_service:server", | ||
], | ||
attributes = pkg_attributes(mode = "0555"), | ||
prefix = "/server/bin", | ||
) | ||
|
||
server_binaries = [ | ||
":server_executables", | ||
] | ||
|
||
pkg_zip( | ||
name = "server_binaries", | ||
srcs = server_binaries, | ||
) | ||
|
||
pkg_tar( | ||
name = "server_binaries_tar", | ||
srcs = server_binaries, | ||
) | ||
|
||
container_layer( | ||
name = "server_binary_layer", | ||
directory = "/", | ||
tars = [ | ||
":server_binaries_tar", | ||
], | ||
) | ||
|
||
container_image( | ||
name = "server_docker_image", | ||
base = select({ | ||
"@platforms//cpu:arm64": "@runtime-cc-debian-arm64//image", | ||
"@platforms//cpu:x86_64": "@runtime-cc-debian-amd64//image", | ||
}), | ||
cmd = [ | ||
"/server/bin/init_server_basic", | ||
], | ||
entrypoint = ["sh"], | ||
env = LOG_ENV_VARS, | ||
labels = {"tee.launch_policy.log_redirect": "always"}, | ||
layers = [ | ||
":server_binary_layer", | ||
], | ||
ports = ["50051"], | ||
) | ||
|
||
container_test( | ||
name = "structure_test", | ||
size = "large", | ||
configs = ["test/structure.yaml"], | ||
driver = "tar", | ||
image = ":server_docker_image", | ||
) | ||
|
||
container_test( | ||
name = "commands_test", | ||
size = "large", | ||
configs = ["test/commands.yaml"], | ||
driver = "docker", | ||
image = ":server_docker_image", | ||
) | ||
|
||
# server artifacts | ||
pkg_zip( | ||
name = "server_artifacts", | ||
srcs = server_binaries, | ||
) | ||
|
||
genrule( | ||
name = "copy_to_dist", | ||
srcs = [ | ||
":server_artifacts", | ||
":server_docker_image.tar", | ||
"//api:bidding_auction_servers_descriptor_set", | ||
], | ||
outs = ["copy_to_dist.bin"], | ||
cmd_bash = """cat << EOF > '$@' | ||
mkdir -p dist/debian | ||
cp $(execpath :server_artifacts) dist/debian/$$(basename $(RULEDIR))_artifacts.zip | ||
cp $(execpath :server_docker_image.tar) dist/debian/$$(basename $(RULEDIR))_image.tar | ||
cp $(execpath //api:bidding_auction_servers_descriptor_set) dist | ||
builders/tools/normalize-dist | ||
EOF""", | ||
executable = True, | ||
local = True, | ||
message = "copying server artifacts to dist/debian directory", | ||
) |
23 changes: 23 additions & 0 deletions
23
production/packaging/azure/auction_service/bin/init_server_basic
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,23 @@ | ||
#!/busybox/sh | ||
# Portions Copyright (c) Microsoft Corporation | ||
# | ||
# 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. | ||
|
||
set -o errexit | ||
set -x | ||
export GLOG_logtostderr=1 | ||
export GLOG_stderrthreshold=0 | ||
export GRPC_DNS_RESOLVER=native | ||
|
||
# Start the server first. | ||
/server/bin/server --init_config_client=true |
24 changes: 24 additions & 0 deletions
24
production/packaging/azure/auction_service/test/commands.yaml
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,24 @@ | ||
# Portions Copyright (c) Microsoft Corporation | ||
# | ||
# 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. | ||
|
||
# refer to docs at https://github.com/GoogleContainerTools/container-structure-test | ||
|
||
schemaVersion: 2.0.0 | ||
|
||
# command tests require the docker toolchain | ||
commandTests: | ||
- name: "server help" | ||
command: "/server/bin/server" | ||
args: ["--help"] | ||
exitCode: 1 |
35 changes: 35 additions & 0 deletions
35
production/packaging/azure/auction_service/test/structure.yaml
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,35 @@ | ||
# Portions Copyright (c) Microsoft Corporation | ||
# | ||
# 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. | ||
|
||
# refer to docs at https://github.com/GoogleContainerTools/container-structure-test | ||
|
||
schemaVersion: 2.0.0 | ||
|
||
fileExistenceTests: | ||
- name: init_server_basic | ||
path: /server/bin/init_server_basic | ||
shouldExist: true | ||
isExecutableBy: any | ||
|
||
- name: server | ||
path: /server/bin/server | ||
shouldExist: true | ||
isExecutableBy: any | ||
|
||
- name: ca-certs | ||
path: /etc/ssl/certs/ca-certificates.crt | ||
shouldExist: true | ||
|
||
licenseTests: | ||
- debian: true |
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,120 @@ | ||
# Portions Copyright (c) Microsoft Corporation | ||
# | ||
# 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. | ||
|
||
load( | ||
"@io_bazel_rules_docker//container:container.bzl", | ||
"container_image", | ||
"container_layer", | ||
) | ||
load("@io_bazel_rules_docker//contrib:test.bzl", "container_test") | ||
load( | ||
"@rules_pkg//pkg:mappings.bzl", | ||
"pkg_attributes", | ||
"pkg_files", | ||
) | ||
load("@rules_pkg//pkg:tar.bzl", "pkg_tar") | ||
load("@rules_pkg//pkg:zip.bzl", "pkg_zip") | ||
load("//:config.bzl", "LOG_ENV_VARS") | ||
|
||
pkg_files( | ||
name = "server_executables", | ||
srcs = [ | ||
"bin/init_server_basic", | ||
"//services/bidding_service:server", | ||
], | ||
attributes = pkg_attributes(mode = "0555"), | ||
prefix = "/server/bin", | ||
) | ||
|
||
server_binaries = [ | ||
":server_executables", | ||
] | ||
|
||
pkg_zip( | ||
name = "server_binaries", | ||
srcs = server_binaries, | ||
) | ||
|
||
pkg_tar( | ||
name = "server_binaries_tar", | ||
srcs = server_binaries, | ||
) | ||
|
||
container_layer( | ||
name = "server_binary_layer", | ||
directory = "/", | ||
tars = [ | ||
":server_binaries_tar", | ||
], | ||
) | ||
|
||
container_image( | ||
name = "server_docker_image", | ||
base = select({ | ||
"@platforms//cpu:arm64": "@runtime-cc-debian-arm64//image", | ||
"@platforms//cpu:x86_64": "@runtime-cc-debian-amd64//image", | ||
}), | ||
cmd = [ | ||
"/server/bin/init_server_basic", | ||
], | ||
entrypoint = ["sh"], | ||
env = LOG_ENV_VARS, | ||
labels = {"tee.launch_policy.log_redirect": "always"}, | ||
layers = [ | ||
":server_binary_layer", | ||
], | ||
ports = ["50051"], | ||
) | ||
|
||
container_test( | ||
name = "structure_test", | ||
size = "large", | ||
configs = ["test/structure.yaml"], | ||
driver = "tar", | ||
image = ":server_docker_image", | ||
) | ||
|
||
container_test( | ||
name = "commands_test", | ||
size = "large", | ||
configs = ["test/commands.yaml"], | ||
driver = "docker", | ||
image = ":server_docker_image", | ||
) | ||
|
||
# server artifacts | ||
pkg_zip( | ||
name = "server_artifacts", | ||
srcs = server_binaries, | ||
) | ||
|
||
genrule( | ||
name = "copy_to_dist", | ||
srcs = [ | ||
":server_artifacts", | ||
":server_docker_image.tar", | ||
"//api:bidding_auction_servers_descriptor_set", | ||
], | ||
outs = ["copy_to_dist.bin"], | ||
cmd_bash = """cat << EOF > '$@' | ||
mkdir -p dist/debian | ||
cp $(execpath :server_artifacts) dist/debian/$$(basename $(RULEDIR))_artifacts.zip | ||
cp $(execpath :server_docker_image.tar) dist/debian/$$(basename $(RULEDIR))_image.tar | ||
cp $(execpath //api:bidding_auction_servers_descriptor_set) dist | ||
builders/tools/normalize-dist | ||
EOF""", | ||
executable = True, | ||
local = True, | ||
message = "copying server artifacts to dist/debian directory", | ||
) |
Oops, something went wrong.