bazel: add build files for go (#1186)

* build: correct toolchain order
* build: gazelle-update-repos
* build: use pregenerated proto for dependencies
* update bazeldnf
* deps: tpm simulator
* Update Google trillian module
* cli: add stamping as alternative build info source
* bazel: add go_test wrappers, mark special tests and select testing deps
* deps: add libvirt deps
* deps: go-libvirt patches
* deps: cloudflare circl patches
* bazel: add go_test wrappers, mark special tests and select testing deps
* bazel: keep gazelle overrides
* bazel: cleanup bazelrc
* bazel: switch CMakeLists.txt to use bazel
* bazel: fix injection of version information via stamping
* bazel: commit all build files
* dev-docs: document bazel usage
* deps: upgrade zig-cc for go 1.20
* bazel: update Perl for macOS arm64 & Linux arm64 support
* bazel: use static perl toolchain for OpenSSL
* bazel: use static protobuf (protoc) toolchain
* deps: add git and go to nix deps

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Malte Poll 2023-03-09 15:23:42 +01:00 committed by GitHub
parent e07be3d6f8
commit bdba9d8ba6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
248 changed files with 18980 additions and 129 deletions

View file

@ -0,0 +1,48 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("//bazel/go:go_test.bzl", "go_test")
go_library(
name = "snp",
srcs = [
"errors.go",
"imds.go",
"issuer.go",
"snp.go",
"validator.go",
],
importpath = "github.com/edgelesssys/constellation/v2/internal/attestation/azure/snp",
visibility = ["//:__subpackages__"],
deps = [
"//internal/attestation/idkeydigest",
"//internal/attestation/measurements",
"//internal/attestation/vtpm",
"//internal/crypto",
"//internal/oid",
"@com_github_google_go_tpm//tpm2",
"@com_github_google_go_tpm_tools//client",
"@com_github_google_go_tpm_tools//proto/attest",
],
)
go_test(
name = "snp_test",
srcs = [
"issuer_test.go",
"validator_test.go",
],
embed = [":snp"],
# keep
gotags = select({
"//bazel/settings:tpm_simulator_enabled": [],
"//conditions:default": ["disable_tpm_simulator"],
}),
deps = [
"//internal/attestation/idkeydigest",
"//internal/attestation/simulator",
"//internal/attestation/vtpm",
"@com_github_google_go_tpm//tpm2",
"@com_github_google_go_tpm_tools//client",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)

View file

@ -14,8 +14,8 @@ import (
"io"
"testing"
"github.com/edgelesssys/constellation/v2/internal/attestation/simulator"
tpmclient "github.com/google/go-tpm-tools/client"
"github.com/google/go-tpm-tools/simulator"
"github.com/google/go-tpm/tpm2"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -51,7 +51,7 @@ func TestGetSNPAttestation(t *testing.T) {
assert := assert.New(t)
require := require.New(t)
tpm, err := simulator.Get()
tpm, err := simulator.OpenSimulatedTPM()
require.NoError(err)
defer tpm.Close()
@ -96,7 +96,7 @@ func TestGetHCLAttestationKey(t *testing.T) {
require := require.New(t)
assert := assert.New(t)
tpm, err := simulator.Get()
tpm, err := simulator.OpenSimulatedTPM()
require.NoError(err)
defer tpm.Close()