update githbu

This commit is contained in:
Elbaz
2023-08-29 13:00:09 +03:00
parent 144f85ac1d
commit 034ae97bdf
13 changed files with 39 additions and 268 deletions

View File

@@ -4,7 +4,7 @@
#
# If you want to test this locally you'll need to set the three arguments
# to values realistic for what the hashicorp/actions-docker-build GitHub
# action would set, and ensure that there's a suitable "terraform" executable
# action would set, and ensure that there's a suitable "opentf" executable
# in the dist/linux/${TARGETARCH} directory.
FROM docker.mirror.hashicorp.services/alpine:latest AS default
@@ -13,21 +13,21 @@ FROM docker.mirror.hashicorp.services/alpine:latest AS default
# action, which sets these appropriately based on context.
ARG PRODUCT_VERSION=UNSPECIFIED
ARG PRODUCT_REVISION=UNSPECIFIED
ARG BIN_NAME=terraform
ARG BIN_NAME=opentf
# This argument is set by the Docker toolchain itself, to the name
# of the CPU architecture we're building an image for.
# Our caller should've extracted the corresponding "terraform" executable
# Our caller should've extracted the corresponding "opentf" executable
# into dist/linux/${TARGETARCH} for us to use.
ARG TARGETARCH
LABEL maintainer="HashiCorp Terraform Team <terraform@hashicorp.com>"
LABEL maintainer="OpenTF Team"
# New standard version label.
LABEL version=$PRODUCT_VERSION
# Historical Terraform-specific label preserved for backward compatibility.
LABEL "com.hashicorp.terraform.version"="${PRODUCT_VERSION}"
# Historical OpenTF-specific label preserved for backward compatibility.
LABEL "com.opentf.version"="${PRODUCT_VERSION}"
RUN apk add --no-cache git openssh

View File

@@ -1,9 +1,9 @@
---
name: build_terraform
name: build_opentf
# This workflow is intended to be called by the build workflow. The crt make
# targets that are utilized automatically determine build metadata and
# handle building and packing Terraform.
# handle building and packing OpenTF.
on:
workflow_call:
@@ -22,7 +22,7 @@ on:
type: string
package-name:
type: string
default: terraform
default: opentf
product-version:
type: string
required: true
@@ -36,7 +36,7 @@ on:
jobs:
build:
runs-on: ${{ inputs.runson }}
name: Terraform ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.product-version }}
name: OpenTF ${{ inputs.goos }} ${{ inputs.goarch }} v${{ inputs.product-version }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
@@ -44,7 +44,7 @@ jobs:
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
- name: Build OpenTF
env:
GOOS: ${{ inputs.goos }}
GOARCH: ${{ inputs.goarch }}
@@ -72,12 +72,12 @@ jobs:
- if: ${{ inputs.goos == 'linux' }}
uses: hashicorp/actions-packaging-linux@v1
with:
name: "terraform"
description: "Terraform enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned."
name: "opentf"
description: "OpenTF enables you to safely and predictably create, change, and improve infrastructure. It is an open source tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned."
arch: ${{ inputs.goarch }}
version: ${{ inputs.product-version }}
maintainer: "HashiCorp"
homepage: "https://terraform.io/"
homepage: "https://opentf.org/"
license: "MPL-2.0"
binary: "dist/opentf"
deb_depends: "git"

View File

@@ -24,7 +24,7 @@ permissions:
jobs:
get-product-version:
name: "Determine intended Terraform version"
name: "Determine intended OpenTF version"
runs-on: ubuntu-latest
outputs:
product-version: ${{ steps.get-product-version.outputs.product-version }}
@@ -53,7 +53,7 @@ jobs:
- name: Report chosen version number
run: |
[ -n "${{steps.get-product-version.outputs.product-version}}" ]
echo "::notice title=Terraform CLI Version::${{ steps.get-product-version.outputs.product-version }}"
echo "::notice title=OpenTF CLI Version::${{ steps.get-product-version.outputs.product-version }}"
get-go-version:
name: "Determine Go toolchain version"
@@ -93,7 +93,7 @@ jobs:
needs:
- get-product-version
- get-go-version
uses: ./.github/workflows/build-terraform-oss.yml
uses: ./.github/workflows/build-opentf-oss.yml
with:
goarch: ${{ matrix.goarch }}
goos: ${{ matrix.goos }}
@@ -134,7 +134,7 @@ jobs:
arch: ["amd64", "386", "arm", "arm64"]
fail-fast: false
env:
repo: "terraform"
repo: "opentf"
version: ${{needs.get-product-version.outputs.product-version}}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
@@ -201,7 +201,7 @@ jobs:
# NOTE: This script reacts to the GOOS, GOARCH, and GO_LDFLAGS
# environment variables defined above. The e2e test harness
# needs to know the version we're building for so it can verify
# that "terraform version" is returning that version number.
# that "opentf version" is returning that version number.
bash ./internal/command/e2etest/make-archive.sh
- name: Save test harness to cache
@@ -252,7 +252,7 @@ jobs:
key: ${{ needs.e2etest-build.outputs.e2e-cache-key }}_${{ matrix.goos }}_${{ matrix.goarch }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: "Download Terraform CLI package"
- name: "Download OpenTF CLI package"
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
id: clipkg
with:
@@ -261,7 +261,7 @@ jobs:
- name: Extract packages
if: ${{ matrix.goos == 'windows' }}
run: |
unzip "${{ needs.e2etest-build.outputs.e2e-cache-path }}/terraform-e2etest_${{ env.os }}_${{ env.arch }}.zip"
unzip "${{ needs.e2etest-build.outputs.e2e-cache-path }}/opentf-e2etest_${{ env.os }}_${{ env.arch }}.zip"
unzip "./opentf_${{env.version}}_${{ env.os }}_${{ env.arch }}.zip"
- name: Set up QEMU
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
@@ -284,7 +284,7 @@ jobs:
e2e-test-exec:
name: Run terraform-exec test for linux amd64
name: Run opentf-exec test for linux amd64
runs-on: ubuntu-latest
needs:
- get-product-version
@@ -301,21 +301,21 @@ jobs:
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: Download Terraform CLI package
- name: Download OpenTF CLI package
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
id: clipkg
with:
name: opentf_${{ env.version }}_linux_amd64.zip
path: .
- name: Checkout terraform-exec repo
- name: Checkout opentf-exec repo
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
repository: hashicorp/terraform-exec
path: terraform-exec
- name: Run terraform-exec end-to-end tests
repository: hashicorp/opentf-exec
path: opentf-exec
- name: Run opentf-exec end-to-end tests
run: |
FULL_RELEASE_VERSION="${{ env.version }}"
unzip opentf_${FULL_RELEASE_VERSION}_linux_amd64.zip
export TFEXEC_E2ETEST_TERRAFORM_PATH="$(pwd)/opentf"
cd terraform-exec
cd opentf-exec
go test -race -timeout=30m -v ./tfexec/internal/e2etest

View File

@@ -100,7 +100,7 @@ jobs:
e2e-tests:
# This is an intentionally-limited form of our E2E test run which only
# covers Terraform running on Linux. The build.yml workflow runs these
# covers OpenTF running on Linux. The build.yml workflow runs these
# tests across various other platforms in order to catch the rare exception
# that might leak through this.
name: "End-to-end Tests"

View File

@@ -1,45 +0,0 @@
name: crt-hook-equivalence-tests
on:
repository_dispatch:
types:
- crt-hook-equivalence-tests::terraform::*
permissions:
contents: write
jobs:
parse-metadata:
name: "Parse metadata.json"
runs-on: ubuntu-latest
outputs:
version: ${{ steps.parse.outputs.version }}
target-branch: ${{ steps.parse.outputs.target-branch }}
steps:
- name: parse
id: parse
env:
METADATA_PAYLOAD: ${{ toJSON(github.event.client_payload.payload) }}
run: |
VERSION=$(echo ${METADATA_PAYLOAD} | jq -r '.version')
TARGET_BRANCH=$(./.github/scripts/equivalence-test.sh get-target-branch "$VERSION")
echo "target-branch=$TARGET_BRANCH" >> "GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
run-equivalence-tests:
runs-on: ubuntu-latest
name: "Run equivalence tests"
needs:
- parse-metadata
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ needs.parse-metadata.outputs.target-branch }}
- uses: ./.github/actions/equivalence-test
with:
target-terraform-version: ${{ needs.parse-metadata.outputs.version }}
target-terraform-branch: ${{ needs.parse-metadata.outputs.target-branch }}
target-equivalence-test-version: 0.3.0
target-os: linux
target-arch: amd64

View File

@@ -1,37 +0,0 @@
name: manual-equivalence-tests
on:
workflow_dispatch:
inputs:
target-branch:
type: string
description: "Which branch should be updated?"
required: true
terraform-version:
type: string
description: "Terraform version to run against (no v prefix, eg. 1.4.4)."
required: true
equivalence-test-version:
type: string
description: 'Equivalence testing framework version to use (no v prefix, eg. 0.3.0).'
default: "0.3.0"
required: true
permissions:
contents: write # We push updates to the equivalence tests back into the repository.
jobs:
run-equivalence-tests:
name: "Run equivalence tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ inputs.target-branch }}
- uses: ./.github/actions/equivalence-test
with:
target-terraform-version: ${{ inputs.terraform-version }}
target-terraform-branch: ${{ inputs.target-branch }}
target-equivalence-test-version: ${{ inputs.equivalence-test-version }}
target-os: linux
target-arch: amd64