Skip to content

Commit

Permalink
Net 9069/add license backport 1.2.x (#3950)
Browse files Browse the repository at this point in the history
* 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

* Net 9069/xw add license file to all bin (#3942)

* debug: missing LICENSE

* use abs path

* use env instead of arg
  • Loading branch information
xwa153 authored Apr 25, 2024
1 parent feb9f40 commit 1e166b7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ jobs:
working-directory: ${{ matrix.component }}
run: |
mkdir -p dist out
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")
Expand All @@ -159,7 +160,14 @@ jobs:
with:
name: ${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}${{ matrix.fips }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: ${{ matrix.component}}/out/${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}${{ matrix.fips }}_${{ 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 $GITHUB_WORKSPACE/LICENSE "$LICENSE_DIR/LICENSE.txt"
- name: Package rpm and deb files
if: matrix.goos == 'linux' && matrix.component == 'cli' && matrix.skip_packaging != 'true'
uses: hashicorp/actions-packaging-linux@v1
Expand All @@ -174,6 +182,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.skip_packaging != 'true'
Expand Down Expand Up @@ -263,6 +272,9 @@ jobs:
run: |
cd "${ZIP_LOCATION}"
unzip -j *.zip
- name: Copy LICENSE
run:
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
Expand Down
20 changes: 15 additions & 5 deletions control-plane/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ ARG CNI_BIN_NAME=consul-cni
ARG VERSION
ARG TARGETARCH
ARG TARGETOS
ENV PRODUCT_NAME=$BIN_NAME

LABEL name=${BIN_NAME} \
maintainer="Team Consul Kubernetes <[email protected]>" \
vendor="HashiCorp" \
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}
Expand Down Expand Up @@ -80,14 +84,18 @@ FROM alpine:3.18 AS release-default
ARG BIN_NAME=consul-k8s-control-plane
ARG CNI_BIN_NAME=consul-cni
ARG PRODUCT_VERSION
ENV PRODUCT_NAME=$BIN_NAME

LABEL name=${BIN_NAME} \
maintainer="Team Consul Kubernetes <[email protected]>" \
vendor="HashiCorp" \
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}
Expand Down Expand Up @@ -141,16 +149,18 @@ 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 <[email protected]>" \
vendor="HashiCorp" \
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}
Expand Down

0 comments on commit 1e166b7

Please sign in to comment.