This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
Merge pull request #4912 from hashicorp/RELPLAT-962-Update-LICENSE-text #343
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- release/* | |
env: | |
METADATA: "oss" | |
PKG_NAME: "waypoint" | |
permissions: | |
contents: read | |
statuses: write | |
packages: write | |
jobs: | |
get-product-version: | |
name: "Determine intended Waypoint version" | |
runs-on: ubuntu-latest | |
outputs: | |
product-version: ${{ steps.get-product-version.outputs.product-version }} | |
base-product-version: ${{ steps.get-product-version.outputs.base-product-version }} | |
prerelease-product-version: ${{ steps.get-product-version.outputs.prerelease-product-version }} | |
pkg-name: ${{ steps.get-pkg-env-vars.outputs.pkg-name }} | |
pkg-metadata: ${{ steps.get-pkg-env-vars.outputs.pkg-metadata }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Get package environment variables | |
id: get-pkg-env-vars | |
run: | | |
pkg_name=${{ env.PKG_NAME }} | |
pkg_metadata=${{ env.METADATA }} | |
echo "pkg-metadata=${pkg_metadata}" | tee -a "${GITHUB_OUTPUT}" | |
echo "pkg-name=${pkg_name}" | tee -a "${GITHUB_OUTPUT}" | |
- name: Decide version number | |
id: get-product-version | |
uses: hashicorp/actions-set-product-version@v1 | |
- name: Report chosen version number | |
run: | | |
[ -n "${{steps.get-product-version.outputs.product-version}}" ] | |
echo "::notice title=Waypoint Version::${{ steps.get-product-version.outputs.product-version }}" | |
get-go-version: | |
name: "Determine Go toolchain version" | |
runs-on: ubuntu-latest | |
outputs: | |
go-version: ${{ steps.get-go-version.outputs.go-version }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Determine Go version | |
id: get-go-version | |
run: | | |
echo "Building with Go $(cat .go-version)" | |
echo "go-version=$(cat .go-version)" >> "$GITHUB_OUTPUT" | |
generate-metadata-file: | |
name: "Generate release metadata" | |
runs-on: ubuntu-latest | |
needs: get-product-version | |
outputs: | |
filepath: ${{ steps.generate-metadata-file.outputs.filepath }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Generate package metadata | |
id: generate-metadata-file | |
uses: hashicorp/actions-generate-metadata@v1 | |
with: | |
version: ${{ needs.get-product-version.outputs.product-version }} | |
product: ${{ env.PKG_NAME }} | |
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | |
with: | |
name: metadata.json | |
path: ${{ steps.generate-metadata-file.outputs.filepath }} | |
build-ui: | |
runs-on: ubuntu-latest | |
name: Build UI | |
needs: get-product-version | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up node and yarn | |
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0 | |
with: | |
node-version: 14 | |
cache: yarn | |
cache-dependency-path: ui/yarn.lock | |
- name: Build UI | |
run: | | |
export PKG_VERSION=${{ needs.get-product-version.outputs.product-version }} | |
export PKG_BINARY_TYPE=${{ needs.get-product-version.outputs.pkg-metadata }} | |
PKG_COPYRIGHT_YEAR="$(git show -s --format=%cd --date=format:%Y HEAD)" ; export PKG_COPYRIGHT_YEAR | |
export PKG_NAME=${{ needs.get-product-version.outputs.pkg-name }} | |
echo "${PKG_NAME} version is ${PKG_VERSION}" | |
echo "${PKG_NAME} binary type is ${PKG_BINARY_TYPE}" | |
echo "${PKG_NAME} copyright year is ${PKG_COPYRIGHT_YEAR}" | |
cd ui && make && cd .. | |
- name: Save assets to cache | |
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: ui/dist/assets | |
key: ui_assets_${{ github.sha }} | |
build-assets: | |
runs-on: ubuntu-latest | |
name: Build Assets | |
needs: | |
- get-go-version | |
- get-product-version | |
- build-ui | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 | |
with: | |
go-version: ${{ needs.get-go-version.outputs.go-version }} | |
- name: Restore ui assets | |
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: ui/dist/assets | |
key: ui_assets_${{ github.sha }} | |
fail-on-cache-miss: true | |
enableCrossOsArchive: true | |
- name: Build assets | |
env: | |
BASE_VERSION: ${{ needs.get-product-version.outputs.base-product-version }} | |
PRERELEASE: ${{ needs.get-product-version.outputs.prerelease-product-version }} | |
run: | | |
make tools | |
go install github.com/kevinburke/go-bindata/go-bindata@v3.24.0+incompatible | |
make bin/crt-assets | |
- name: Save assets to cache | |
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: internal/assets | |
key: build_assets_${{ github.sha }} | |
build-waypoint: | |
needs: | |
- get-product-version | |
- get-go-version | |
- build-assets | |
- build-ui | |
strategy: | |
matrix: | |
pkg-name: [ "waypoint", "waypoint-entrypoint" ] | |
goos: [ linux ] | |
goarch: [ "386", "amd64", "arm", "arm64" ] | |
include: | |
- {goos: "windows", goarch: "386", pkg-name: "waypoint" } | |
- {goos: "windows", goarch: "amd64", pkg-name: "waypoint"} | |
- {goos: "darwin", goarch: "arm64", pkg-name: "waypoint"} | |
- {goos: "darwin", goarch: "amd64", pkg-name: "waypoint"} | |
- { goos: "darwin", goarch: "arm64", pkg-name: "waypoint-entrypoint" } | |
- { goos: "darwin", goarch: "amd64", pkg-name: "waypoint-entrypoint" } | |
name: Go ${{ matrix.goos }} ${{ matrix.goarch }} build | |
uses: ./.github/workflows/build-waypoint-oss.yml | |
with: | |
create-packages: false | |
goarch: ${{ matrix.goarch }} | |
goos: ${{ matrix.goos }} | |
go-tags: ui | |
go-version: ${{ needs.get-go-version.outputs.go-version }} | |
package-name: ${{ matrix.pkg-name }} | |
waypoint-version: ${{ needs.get-product-version.outputs.product-version }} | |
waypoint-base-version: ${{ needs.get-product-version.outputs.base-product-version }} | |
waypoint-prerelease: ${{ needs.get-product-version.outputs.prerelease-product-version }} | |
secrets: inherit | |
package-docker-waypoint-server: | |
name: Build Docker Server image for linux_${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
needs: | |
- get-product-version | |
- build-waypoint | |
strategy: | |
matrix: | |
arch: [ "amd64", "arm64" ] | |
fail-fast: false | |
env: | |
repo: "waypoint" | |
version: ${{ needs.get-product-version.outputs.product-version }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Download Waypoint | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
path: archive | |
name: waypoint_${{env.version}}_linux_${{ matrix.arch }}.zip | |
- name: Download Entrypoint | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
path: archive | |
name: waypoint-entrypoint_${{ env.version }}_linux_${{ matrix.arch }}.zip | |
- name: Prepare zipped binaries to build Docker image | |
id: prepare-zips | |
run: | | |
DIR="$(mktemp -d)" | |
echo "working-dir=$DIR" >> "$GITHUB_OUTPUT" | |
cp -v CRT.Dockerfile "$DIR/CRT.Dockerfile" | |
unzip -j "archive/waypoint_${{env.version}}_linux_${{ matrix.arch }}.zip" -d "$DIR" | |
unzip -j "archive/waypoint-entrypoint_${{env.version}}_linux_${{ matrix.arch }}.zip" -d "$DIR" | |
- name: Build Docker image | |
uses: hashicorp/actions-docker-build@v1 | |
with: | |
pkg_name: "waypoint_${{env.version}}" | |
dockerfile: CRT.Dockerfile | |
version: ${{ env.version }} | |
bin_name: ${{ env.repo }} | |
do_zip_extract_step: false | |
workdir: ${{ steps.prepare-zips.outputs.working-dir }} | |
target: crt | |
arch: ${{matrix.arch}} | |
smoke_test: .github/scripts/verify_docker.sh ${{ needs.get-product-version.outputs.product-version }} | |
tags: | | |
docker.io/hashicorp/${{env.repo}}:${{env.version}} | |
public.ecr.aws/hashicorp/${{env.repo}}:${{env.version}} | |
package-docker-waypoint-odr: | |
name: Build Docker ODR image for linux_${{ matrix.arch }} | |
runs-on: ubuntu-latest | |
needs: | |
- get-product-version | |
- build-waypoint | |
strategy: | |
matrix: | |
arch: [ "amd64", "arm64" ] | |
fail-fast: false | |
env: | |
repo: "waypoint" | |
version: ${{ needs.get-product-version.outputs.product-version }} | |
steps: | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Build Docker image | |
uses: hashicorp/actions-docker-build@v1 | |
with: | |
pkg_name: "waypoint_${{env.version}}" | |
dockerfile: CRT.Dockerfile | |
version: ${{ env.version }} | |
bin_name: ${{ env.repo }} | |
target: odr-crt | |
arch: ${{matrix.arch}} | |
smoke_test: .github/scripts/verify_docker.sh ${{ needs.get-product-version.outputs.product-version }} | |
tags: | | |
docker.io/hashicorp/${{env.repo}}-odr:${{env.version}} | |
public.ecr.aws/hashicorp/${{env.repo}}-odr:${{env.version}} | |
end-to-end-tests: | |
needs: | |
- get-product-version | |
- package-docker-waypoint-server | |
- package-docker-waypoint-odr | |
uses: ./.github/workflows/end-to-end.yml | |
with: | |
waypoint-binary: waypoint_${{needs.get-product-version.outputs.product-version}}_linux_amd64.zip | |
waypoint-tar: waypoint_crt_linux_amd64_${{needs.get-product-version.outputs.product-version}}_${{github.sha}}.docker.tar | |
waypoint-image: hashicorp/waypoint:${{ needs.get-product-version.outputs.product-version }} | |
waypoint-odr-tar: waypoint_odr-crt_linux_amd64_${{needs.get-product-version.outputs.product-version}}_${{github.sha}}.docker.tar | |
waypoint-odr-image: hashicorp/waypoint-odr:${{ needs.get-product-version.outputs.product-version }} | |
secrets: inherit | |