From f942e55ff468efec082f724a03250f13c05db10e Mon Sep 17 00:00:00 2001 From: wangxinyi7 Date: Mon, 22 Apr 2024 11:19:18 -0700 Subject: [PATCH 1/3] add missing license file (#3921) * add missing license file * missed copying the license file to workdir * make up missing value and remove redundant directory creation --- .github/workflows/build.yml | 12 ++++++++++++ control-plane/Dockerfile | 17 ++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b7abb9307..ade47981cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,6 +112,7 @@ jobs: working-directory: ${{ matrix.component }} run: | mkdir -p dist out + cp LICENSE dist/LICENSE.txt export GIT_COMMIT=$(git rev-parse --short HEAD) export GIT_DIRTY=$(test -n "$(git status --porcelain)" && echo "+CHANGES") @@ -127,6 +128,13 @@ jobs: name: ${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip path: ${{ matrix.component}}/out/${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip + - name: Copy license file + env: + LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ env.PKG_NAME }}" + run: | + mkdir -p "$LICENSE_DIR" + cp LICENSE "$LICENSE_DIR/LICENSE.txt" + - name: Package rpm and deb files if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} uses: hashicorp/actions-packaging-linux@v1 @@ -141,6 +149,7 @@ jobs: binary: "${{ matrix.component }}/dist/${{ matrix.pkg_name }}" deb_depends: "openssl" rpm_depends: "openssl" + config_dir: ".release/linux/package/" - name: Set package names if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} @@ -220,6 +229,9 @@ jobs: run: | cd "${ZIP_LOCATION}" unzip -j *.zip + - name: Copy LICENSE + run: + cp LICENSE ./control-plane # This naming convention will be used ONLY for per-commit dev images - name: Set docker dev tag diff --git a/control-plane/Dockerfile b/control-plane/Dockerfile index 30b26f460f..89ebbcf7ef 100644 --- a/control-plane/Dockerfile +++ b/control-plane/Dockerfile @@ -32,6 +32,7 @@ ARG CNI_BIN_NAME=consul-cni ARG VERSION ARG TARGETARCH ARG TARGETOS +ARG PRODUCT_NAME=$BIN_NAME LABEL name=${BIN_NAME} \ maintainer="Team Consul Kubernetes " \ @@ -39,7 +40,10 @@ LABEL name=${BIN_NAME} \ version=${VERSION} \ release=${VERSION} \ summary="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." \ - description="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." + description="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." \ + org.opencontainers.image.licenses="MPL-2.0" + +COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt # Set ARGs as ENV so that they can be used in ENTRYPOINT/CMD ENV BIN_NAME=${BIN_NAME} @@ -80,6 +84,7 @@ FROM alpine:3.18 AS release-default ARG BIN_NAME=consul-k8s-control-plane ARG CNI_BIN_NAME=consul-cni ARG PRODUCT_VERSION +ARG PRODUCT_NAME=$BIN_NAME LABEL name=${BIN_NAME} \ maintainer="Team Consul Kubernetes " \ @@ -87,7 +92,10 @@ LABEL name=${BIN_NAME} \ version=${PRODUCT_VERSION} \ release=${PRODUCT_VERSION} \ summary="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." \ - description="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." + description="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." \ + org.opencontainers.image.licenses="MPL-2.0" + +COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt # Set ARGs as ENV so that they can be used in ENTRYPOINT/CMD ENV BIN_NAME=${BIN_NAME} @@ -143,7 +151,10 @@ LABEL name=$PRODUCT_NAME \ version=$PRODUCT_VERSION \ release=$PRODUCT_VERSION \ summary="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." \ - description="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." + description="consul-k8s-control-plane provides first-class integrations between Consul and Kubernetes." \ + org.opencontainers.image.licenses="MPL-2.0" + +COPY LICENSE /usr/share/doc/$PRODUCT_NAME/LICENSE.txt # Set ARGs as ENV so that they can be used in ENTRYPOINT/CMD ENV NAME=${BIN_NAME} From cf161bfc4f9ede86ac9b1f028cb4ff714c221cc8 Mon Sep 17 00:00:00 2001 From: wangxinyi7 Date: Mon, 22 Apr 2024 13:13:56 -0700 Subject: [PATCH 2/3] Net 9069/xw add license file to all bin (#3942) * debug: missing LICENSE * use abs path --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ade47981cb..50b6ccefbc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,7 +112,7 @@ jobs: working-directory: ${{ matrix.component }} run: | mkdir -p dist out - cp LICENSE dist/LICENSE.txt + cp $GITHUB_WORKSPACE/LICENSE dist/LICENSE.txt export GIT_COMMIT=$(git rev-parse --short HEAD) export GIT_DIRTY=$(test -n "$(git status --porcelain)" && echo "+CHANGES") @@ -133,7 +133,7 @@ jobs: LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ env.PKG_NAME }}" run: | mkdir -p "$LICENSE_DIR" - cp LICENSE "$LICENSE_DIR/LICENSE.txt" + cp $GITHUB_WORKSPACE/LICENSE "$LICENSE_DIR/LICENSE.txt" - name: Package rpm and deb files if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}} @@ -231,7 +231,7 @@ jobs: unzip -j *.zip - name: Copy LICENSE run: - cp LICENSE ./control-plane + cp $GITHUB_WORKSPACE/LICENSE $GITHUB_WORKSPACE/control-plane # This naming convention will be used ONLY for per-commit dev images - name: Set docker dev tag From ed8de99751677b683a4a4260c967909bc18912d3 Mon Sep 17 00:00:00 2001 From: Xinyi Wang Date: Wed, 24 Apr 2024 16:30:41 -0700 Subject: [PATCH 3/3] use env instead of arg --- control-plane/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/control-plane/Dockerfile b/control-plane/Dockerfile index 89ebbcf7ef..7d9c952fc0 100644 --- a/control-plane/Dockerfile +++ b/control-plane/Dockerfile @@ -32,7 +32,7 @@ ARG CNI_BIN_NAME=consul-cni ARG VERSION ARG TARGETARCH ARG TARGETOS -ARG PRODUCT_NAME=$BIN_NAME +ENV PRODUCT_NAME=$BIN_NAME LABEL name=${BIN_NAME} \ maintainer="Team Consul Kubernetes " \ @@ -84,7 +84,7 @@ FROM alpine:3.18 AS release-default ARG BIN_NAME=consul-k8s-control-plane ARG CNI_BIN_NAME=consul-cni ARG PRODUCT_VERSION -ARG PRODUCT_NAME=$BIN_NAME +ENV PRODUCT_NAME=$BIN_NAME LABEL name=${BIN_NAME} \ maintainer="Team Consul Kubernetes " \ @@ -142,8 +142,7 @@ ARG VERSION # and the version to download. Example: PRODUCT_NAME=consul PRODUCT_VERSION=1.2.3. ENV BIN_NAME=$BIN_NAME ENV PRODUCT_VERSION=$PRODUCT_VERSION - -ARG PRODUCT_NAME=$BIN_NAME +ENV PRODUCT_NAME=$BIN_NAME LABEL name=$PRODUCT_NAME \ maintainer="Team Consul Kubernetes " \