Use CMake project version across all places & remove obsolete build tags

This commit is contained in:
Nils Hanke 2022-09-09 13:40:30 +02:00 committed by Nils Hanke
parent aa75a065d7
commit 9bedaf20ea
4 changed files with 8 additions and 17 deletions

View File

@ -51,10 +51,9 @@ runs:
- name: Build CLI - name: Build CLI
run: | run: |
echo "::group::Build CLI" echo "::group::Build CLI"
GIT_TAG=$(git describe --tags --always --dirty --abbrev=0)
mkdir -p build mkdir -p build
cd build cd build
cmake -DCLI_BUILD_TAGS:STRING=gcp,enterprise -DCLI_VERSION:STRING=${GIT_TAG} .. cmake -DCLI_BUILD_TAGS:STRING=enterprise ..
GOOS=${{ inputs.targetOS }} GOARCH=${{ inputs.targetArch }} make -j`nproc` cli GOOS=${{ inputs.targetOS }} GOARCH=${{ inputs.targetArch }} make -j`nproc` cli
cp constellation constellation-${{ inputs.targetOS }}-${{ inputs.targetArch }} cp constellation constellation-${{ inputs.targetOS }}-${{ inputs.targetArch }}
echo "$(pwd)" >> $GITHUB_PATH echo "$(pwd)" >> $GITHUB_PATH

View File

@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 3.11) cmake_minimum_required(VERSION 3.11)
project(constellation LANGUAGES C VERSION 0.1.0) project(constellation LANGUAGES C VERSION 2.0.0)
set(CLI_BUILD_TAGS "" CACHE STRING "Tags passed to go build of Constellation CLI.")
set(CLI_VERSION "v0.1.0" CACHE STRING "Version of CLI binary.")
set(CLI_BUILD_TAGS "gcp" CACHE STRING "Tags passed to go build of Constellation CLI.")
enable_testing() enable_testing()
@ -10,7 +8,7 @@ enable_testing()
# core-os disk-mapper # core-os disk-mapper
# #
add_custom_target(disk-mapper ALL add_custom_target(disk-mapper ALL
DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} -f Dockerfile.build --target disk-mapper . DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} --build-arg PROJECT_VERSION=${PROJECT_VERSION} -f Dockerfile.build --target disk-mapper .
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
BYPRODUCTS disk-mapper BYPRODUCTS disk-mapper
) )
@ -18,20 +16,17 @@ add_custom_target(disk-mapper ALL
# #
# bootstrapper # bootstrapper
# #
add_custom_target(bootstrapper ALL add_custom_target(bootstrapper ALL
DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} --build-arg PROJECT_VERSION=${PROJECT_VERSION} -f Dockerfile.build --target bootstrapper . DOCKER_BUILDKIT=1 docker build -o ${CMAKE_BINARY_DIR} --build-arg PROJECT_VERSION=${PROJECT_VERSION} -f Dockerfile.build --target bootstrapper .
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
BYPRODUCTS bootstrapper BYPRODUCTS bootstrapper
) )
# #
# cli # cli
# #
add_custom_target(cli ALL add_custom_target(cli ALL
CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/constellation -tags='${CLI_BUILD_TAGS}' -ldflags "-buildid='' -X github.com/edgelesssys/constellation/internal/constants.VersionInfo=${CLI_VERSION}" CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/constellation -tags='${CLI_BUILD_TAGS}' -ldflags "-buildid='' -X github.com/edgelesssys/constellation/internal/constants.VersionInfo=${PROJECT_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cli WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/cli
BYPRODUCTS constellation BYPRODUCTS constellation
) )
@ -39,7 +34,6 @@ add_custom_target(cli ALL
# #
# testing / debugging # testing / debugging
# #
add_custom_target(debug_bootstrapper add_custom_target(debug_bootstrapper
go build -o ${CMAKE_BINARY_DIR}/debug_bootstrapper -buildvcs=false -ldflags "-buildid='' -X main.version=${PROJECT_VERSION}" go build -o ${CMAKE_BINARY_DIR}/debug_bootstrapper -buildvcs=false -ldflags "-buildid='' -X main.version=${PROJECT_VERSION}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bootstrapper/cmd/bootstrapper WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bootstrapper/cmd/bootstrapper
@ -49,7 +43,6 @@ add_custom_target(debug_bootstrapper
# #
# debugd # debugd
# #
add_custom_target(debugd ALL add_custom_target(debugd ALL
CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/debugd -buildvcs=false -ldflags "-buildid=''" CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/debugd -buildvcs=false -ldflags "-buildid=''"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/debugd/cmd/debugd WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/debugd/cmd/debugd
@ -59,7 +52,6 @@ add_custom_target(debugd ALL
# #
# cdbg # cdbg
# #
add_custom_target(cdbg ALL add_custom_target(cdbg ALL
CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/cdbg -buildvcs=false -ldflags "-buildid=''" CGO_ENABLED=0 go build -o ${CMAKE_BINARY_DIR}/cdbg -buildvcs=false -ldflags "-buildid=''"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/debugd/cmd/cdbg WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/debugd/cmd/cdbg

View File

@ -33,12 +33,12 @@ FROM build AS build-bootstrapper
WORKDIR /constellation/bootstrapper/ WORKDIR /constellation/bootstrapper/
ARG PROJECT_VERSION ARG PROJECT_VERSION
RUN go build -o bootstrapper -tags=gcp,disable_tpm_simulator -buildvcs=false -ldflags "-s -w -buildid='' -X main.version=${PROJECT_VERSION}" ./cmd/bootstrapper/ RUN go build -o bootstrapper -tags=disable_tpm_simulator -buildvcs=false -ldflags "-s -w -buildid='' -X main.version=${PROJECT_VERSION}" ./cmd/bootstrapper/
FROM build AS build-disk-mapper FROM build AS build-disk-mapper
WORKDIR /constellation/disk-mapper/ WORKDIR /constellation/disk-mapper/
RUN go build -o disk-mapper -ldflags "-s -w" ./cmd/ RUN go build -o disk-mapper -ldflags "-s -w -buildid='' -X github.com/edgelesssys/constellation/internal/constants.VersionInfo=${PROJECT_VERSION}" ./cmd/
FROM scratch AS bootstrapper FROM scratch AS bootstrapper
COPY --from=build-bootstrapper /constellation/bootstrapper/bootstrapper / COPY --from=build-bootstrapper /constellation/bootstrapper/bootstrapper /

View File

@ -44,6 +44,6 @@ Implements interaction with the Kubernetes API to create join tokens for new nod
## [Dockerfile](./Dockerfile) ## [Dockerfile](./Dockerfile)
```shell ```shell
export VERSION=1.0.0 export VERSION=0.0.0
DOCKER_BUILDKIT=1 docker build --build-arg PROJECT_VERSION=${VERSION} -t ghcr.io/edgelesssys/constellation/join-service:v${VERSION} -f joinservice/Dockerfile . DOCKER_BUILDKIT=1 docker build --build-arg PROJECT_VERSION=${VERSION} -t ghcr.io/edgelesssys/constellation/join-service:v${VERSION} -f joinservice/Dockerfile .
``` ```