Skip to content

Commit

Permalink
test devbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
elchead committed Jan 2, 2024
1 parent 822913c commit cfba143
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 57 deletions.
2 changes: 2 additions & 0 deletions .github/actions/setup_bazel_nix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ runs:
- name: Install nix
if: steps.check_inputs.outputs.nixPreinstalled == 'false'
uses: cachix/install-nix-action@7ac1ec25491415c381d9b62f0657c7a028df52a7 # v24
with:
extra_nix_config: "allowUnfree = true"

- name: Set $USER if not set
shell: bash
Expand Down
66 changes: 9 additions & 57 deletions .github/workflows/e2e-test-provider-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ on:
description: Kubernetes version to target for the upgrade, empty for no upgrade.
type: string
required: false
toProviderVersion:
description: Provider version and microservice version to target for the upgrade (with v prefix). Empty value means use provider from source.
type: string
required: false
workflow_call:
inputs:
ref:
Expand All @@ -61,10 +57,6 @@ on:
description: Kubernetes version to target for the upgrade, empty for target's default version.
type: string
required: false
toProviderVersion:
description: Provider version and microservice version to target for the upgrade (with v prefix). Empty value means use provider from source.
type: string
required: false

jobs:
provider-example-test:
Expand Down Expand Up @@ -111,16 +103,6 @@ jobs:
last_three="${run_id: -3}"
echo "prefix=e2e-${last_three}" | tee -a "$GITHUB_OUTPUT"
- name: Install dependencies (Terraform)
shell: bash
run: |
sudo apt update && sudo apt install gpg
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt install terraform=1.4.4-*
- name: Log in to the Container registry
uses: ./.github/actions/container_registry_login
with:
Expand All @@ -129,42 +111,18 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Setup bazel
if: inputs.providerVersion == '' || inputs.toProviderVersion == ''
uses: ./.github/actions/setup_bazel_nix
with:
useCache: "true"
buildBuddyApiKey: ${{ secrets.BUILDBUDDY_ORG_API_KEY }}
nixTools: terraform

- name: Build CLI # CLI is needed for the upgrade assert and container push is needed for the microservice upgrade
uses: ./.github/actions/build_cli
with:
enterpriseCLI: true
outputPath: "build/constellation"
push: true

- name: Build Terraform provider binary
if: inputs.providerVersion == '' || inputs.toProviderVersion == ''
uses: ./.github/actions/build_tf_provider
with:
targetOS: 'linux'
targetArch: 'amd64'
outputPath: "build/terraform-provider-constellation"

- name: Add to local Terraform registry
if: inputs.providerVersion == '' # only move if needed, because otherwise the public TF registry will not be used
- name: Build Constellation provider # CLI is needed for the upgrade assert and container push is needed for the microservice upgrade
shell: bash
id: install_tf_provider
run: |
bazel build //bazel/settings:tag
repository_root=$(git rev-parse --show-toplevel)
out_rel=$(bazel cquery --output=files //bazel/settings:tag)
build_version=$(cat "$(realpath "${repository_root}/${out_rel}")")
terraform_provider_dir="${HOME}/.terraform.d/plugins/registry.terraform.io/edgelesssys/constellation/${build_version#v}/linux_amd64/"
mkdir -p "${terraform_provider_dir}"
mv build/terraform-provider-constellation "${terraform_provider_dir}/terraform-provider-constellation_${build_version}"
echo "build_version=${build_version}" | tee -a "$GITHUB_OUTPUT"
mkdir build
cd build
bazel run //:devbuild --cli_edition=enterprise
- name: Login to AWS (IAM + Cluster role)
if: inputs.cloudProvider == 'aws'
Expand Down Expand Up @@ -333,12 +291,12 @@ jobs:
terraform_provider_dir="${HOME}/.terraform.d/plugins/registry.terraform.io/edgelesssys/constellation/${build_version#v}/linux_amd64/"
# remove local registry if it was used and public registry should be used now
if [[ "${{ inputs.providerVersion }}" == "" && "${{ inputs.toProviderVersion }}" != "" ]]; then
if [[ "${{ inputs.providerVersion }}" == "" ]]; then
rm -rf "${terraform_provider_dir}"
fi
# add to local registry if it was not used and local registry should be used now
if [[ "${{ inputs.providerVersion }}" != "" && "${{ inputs.toProviderVersion }}" == "" ]]; then
if [[ "${{ inputs.providerVersion }}" != "" ]]; then
mkdir -p "${terraform_provider_dir}"
mv build/terraform-provider-constellation "${terraform_provider_dir}/terraform-provider-constellation_${build_version}"
fi
Expand All @@ -364,21 +322,15 @@ jobs:
EOF
fi
if [[ "${{ inputs.toProviderVersion }}" == "" ]]; then
prefixed_version=${{ steps.upgrade_tf_provider.outputs.build_version }}
else
prefixed_version="${{ inputs.toProviderVersion }}"
fi
prefixed_version=${{ steps.upgrade_tf_provider.outputs.build_version }}
version=${prefixed_version#v} # remove v prefix
# needs to be explicitly set to upgrade
if [[ "${{ inputs.toProviderVersion }}" == "" ]]; then
cat >> _override.tf <<EOF
resource "constellation_cluster" "${{ inputs.cloudProvider }}_example" {
constellation_microservice_version = "${prefixed_version}"
}
EOF
fi
cat >> _override.tf <<EOF
terraform {
Expand All @@ -404,7 +356,7 @@ jobs:
env:
IMAGE: ${{ inputs.toImage && inputs.toImage || steps.find-latest-image.outputs.image }}
KUBERNETES: ${{ inputs.toKubernetes }}
MICROSERVICES: ${{ inputs.toProviderVersion }}
MICROSERVICES: ${{ steps.find-latest-image.outputs.image }}
WORKERNODES: 1
CONTROLNODES: 1
run: |
Expand Down

0 comments on commit cfba143

Please sign in to comment.