legal: Include license in release zip, Docker image and linux packages (#34977)

pull/35066/head
Nara Kasbergen Kwon 2 years ago committed by GitHub
parent 448775102c
commit d0fcb21309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -29,8 +29,23 @@ LABEL version=$PRODUCT_VERSION
# Historical Terraform-specific label preserved for backward compatibility.
LABEL "com.hashicorp.terraform.version"="${PRODUCT_VERSION}"
# @see https://specs.opencontainers.org/image-spec/annotations/?v=v1.0.1#pre-defined-annotation-keys
LABEL org.opencontainers.image.title=${BIN_NAME} \
org.opencontainers.image.description="Terraform enables you to safely and predictably create, change, and improve infrastructure" \
org.opencontainers.image.authors="HashiCorp Terraform Team <terraform@hashicorp.com>" \
org.opencontainers.image.url="https://www.terraform.io/" \
org.opencontainers.image.documentation="https://www.terraform.io/docs" \
org.opencontainers.image.source="https://github.com/hashicorp/terraform" \
org.opencontainers.image.version=${PRODUCT_VERSION} \
org.opencontainers.image.revision=${PRODUCT_REVISION} \
org.opencontainers.image.vendor="HashiCorp" \
org.opencontainers.image.licenses="BUSL-1.1"
RUN apk add --no-cache git openssh
# Copy the license file as per Legal requirement
COPY LICENSE "/usr/share/doc/${BIN_NAME}/LICENSE.txt"
# The hashicorp/actions-docker-build GitHub Action extracts the appropriate
# release package for our target architecture into the current working
# directory before running "docker build", which we'll then copy into the

@ -42,8 +42,6 @@ jobs:
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ inputs.go-version }}
- name: Determine artifact basename
run: echo "ARTIFACT_BASENAME=${{ inputs.package-name }}_${{ inputs.product-version }}_${{ inputs.goos }}_${{ inputs.goarch }}.zip" >> $GITHUB_ENV
- name: Build Terraform
env:
GOOS: ${{ inputs.goos }}
@ -51,7 +49,7 @@ jobs:
GO_LDFLAGS: ${{ inputs.ld-flags }}
ACTIONSOS: ${{ inputs.runson }}
CGO_ENABLED: ${{ inputs.cgo-enabled }}
uses: hashicorp/actions-go-build@v0.1.7
uses: hashicorp/actions-go-build@e20c6be7bf010e40e930dab20e6da63176725ec1 # v0.1.9
with:
product_name: ${{ inputs.package-name }}
product_version: ${{ inputs.product-version }}
@ -60,15 +58,14 @@ jobs:
arch: ${{ inputs.goarch }}
reproducible: nope
instructions: |-
mkdir dist out
set -x
go build -ldflags "${{ inputs.ld-flags }}" -o dist/ .
zip -r -j out/${{ env.ARTIFACT_BASENAME }} dist/
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: ${{ env.ARTIFACT_BASENAME }}
path: out/${{ env.ARTIFACT_BASENAME }}
if-no-files-found: error
go build -ldflags "${{ inputs.ld-flags }}" -o "$BIN_PATH" -trimpath -buildvcs=false
cp LICENSE "$TARGET_DIR/LICENSE.txt"
- name: Copy license file to config_dir
if: ${{ matrix.goos == 'linux' }}
env:
LICENSE_DIR: ".release/linux/package/usr/share/doc/${{ inputs.package-name }}"
run: |
mkdir -p "$LICENSE_DIR" && cp LICENSE "$LICENSE_DIR/LICENSE.txt"
- if: ${{ inputs.goos == 'linux' }}
uses: hashicorp/actions-packaging-linux@v1
with:
@ -82,6 +79,7 @@ jobs:
binary: "dist/terraform"
deb_depends: "git"
rpm_depends: "git"
config_dir: ".release/linux/package/"
- if: ${{ inputs.goos == 'linux' }}
name: Determine package file names
run: |

Loading…
Cancel
Save