Ensure build tag "aro" is present

make runlocal-rp
Fail run and use Tests to report -tags status
Updated doc
This commit is contained in:
Drew Anderson 2021-08-26 16:17:38 +02:00 коммит произвёл Mikalai Radchuk
Родитель 198c206614
Коммит d61fd1609f
6 изменённых файлов: 50 добавлений и 5 удалений

Просмотреть файл

@ -12,10 +12,13 @@ ifneq ($(shell uname -s),Darwin)
endif
build-all:
go build -tags containers_image_openpgp ./...
go build -tags aro,containers_image_openpgp ./...
aro: generate
go build -tags containers_image_openpgp,codec.safe -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./cmd/aro
go build -tags aro,containers_image_openpgp,codec.safe -ldflags "-X github.com/Azure/ARO-RP/pkg/util/version.GitCommit=$(COMMIT)" ./cmd/aro
runlocal-rp:
go run -tags aro ./cmd/aro rp
az: pyenv
. pyenv/bin/activate && \
@ -143,7 +146,7 @@ validate-go:
go test -tags e2e -run ^$$ ./test/e2e/...
unit-test-go:
go run ./vendor/gotest.tools/gotestsum/main.go --format pkgname --junitfile report.xml -- -coverprofile=cover.out ./...
go run ./vendor/gotest.tools/gotestsum/main.go --format pkgname --junitfile report.xml -- -tags=aro -coverprofile=cover.out ./...
lint-go:
go run ./vendor/github.com/golangci/golangci-lint/cmd/golangci-lint run
@ -161,4 +164,4 @@ vendor:
# See comments in the script for background on why we need it
hack/update-go-module-dependencies.sh
.PHONY: admin.kubeconfig aro az clean client deploy dev-config.yaml discoverycache generate image-aro image-aro-multistage image-fluentbit image-proxy lint-go proxy publish-image-aro publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go
.PHONY: admin.kubeconfig aro az clean client deploy dev-config.yaml discoverycache generate image-aro image-aro-multistage image-fluentbit image-proxy lint-go runlocal-rp proxy publish-image-aro publish-image-aro-multistage publish-image-fluentbit publish-image-proxy secrets secrets-update e2e.test tunnel test-e2e test-go test-python vendor build-all validate-go unit-test-go coverage-go

Просмотреть файл

@ -0,0 +1,6 @@
package main
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
var platformIsAro bool

Просмотреть файл

@ -0,0 +1,10 @@
// +build aro
package main
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
func init() {
platformIsAro = true
}

Просмотреть файл

@ -0,0 +1,21 @@
package main
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"testing"
)
func TestEnsureAroTag(t *testing.T) {
/*
This file should always fail this test when "+build !aro".
The 'aro' tag is required for the openshift/installer to disable certain
functionality which are valid for OpenShift on Azure, but not valid for ARO deployments.
Related: https://github.com/openshift/installer/pull/4843
*/
// TODO: Use `azuretypes.Platform.IsARO()` from github.com/openshift/installer/pkg/types/azure
if !platformIsAro {
t.Fatalf("ARO-RP must be built, run, and tested with '-tags aro' to support github.com/openshift/installer, see https://github.com/openshift/installer/pull/4843/files")
}
}

Просмотреть файл

@ -42,6 +42,11 @@ func main() {
audit := utillog.GetAuditEntry()
log := utillog.GetLogger()
// TODO: Use `azuretypes.Platform.IsARO()` from github.com/openshift/installer/pkg/types/azure
if !platformIsAro {
log.Fatal("ARO-RP must be built, run, and tested with '-tags aro' to support github.com/openshift/installer, see https://github.com/openshift/installer/pull/4843/files")
}
go func() {
log.Warn(http.ListenAndServe("localhost:6060", nil))
}()

Просмотреть файл

@ -88,7 +88,7 @@
1. Run the RP
```bash
go run ./cmd/aro rp
make runlocal-rp
```
1. To create a cluster, EITHER follow the instructions in [Create, access, and