2023-08-18 14:56:33 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
|
|
name: Nightly test-integrations
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
# Run nightly at 12AM UTC/8PM EST/5PM PST
|
2024-06-10 22:28:54 +00:00
|
|
|
- cron: '0 0 * * *'
|
2023-08-18 14:56:33 +00:00
|
|
|
workflow_dispatch: {}
|
|
|
|
|
|
|
|
env:
|
|
|
|
TEST_RESULTS_DIR: /tmp/test-results
|
|
|
|
TEST_RESULTS_ARTIFACT_NAME: test-results
|
|
|
|
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }}
|
|
|
|
GOTAGS: ${{ endsWith(github.repository, '-enterprise') && 'consulent' || '' }}
|
2023-11-20 16:39:51 +00:00
|
|
|
GOTESTSUM_VERSION: "1.11.0"
|
2023-08-18 14:56:33 +00:00
|
|
|
CONSUL_BINARY_UPLOAD_NAME: consul-bin
|
|
|
|
# strip the hashicorp/ off the front of github.repository for consul
|
|
|
|
CONSUL_LATEST_IMAGE_NAME: ${{ endsWith(github.repository, '-enterprise') && github.repository || 'hashicorp/consul' }}
|
|
|
|
GOPRIVATE: github.com/hashicorp # Required for enterprise deps
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Setup
|
|
|
|
outputs:
|
|
|
|
compute-small: ${{ steps.runners.outputs.compute-small }}
|
|
|
|
compute-medium: ${{ steps.runners.outputs.compute-medium }}
|
|
|
|
compute-large: ${{ steps.runners.outputs.compute-large }}
|
|
|
|
compute-xl: ${{ steps.runners.outputs.compute-xl }}
|
|
|
|
enterprise: ${{ steps.runners.outputs.enterprise }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- id: runners
|
|
|
|
run: .github/scripts/get_runner_classes.sh
|
|
|
|
|
2024-01-08 22:18:41 +00:00
|
|
|
get-go-version:
|
|
|
|
uses: ./.github/workflows/reusable-get-go-version.yml
|
|
|
|
|
2024-07-05 19:19:23 +00:00
|
|
|
get-envoy-versions:
|
|
|
|
uses: ./.github/workflows/reusable-get-envoy-versions.yml
|
|
|
|
|
2023-08-18 14:56:33 +00:00
|
|
|
dev-build:
|
2024-01-08 22:18:41 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- get-go-version
|
2023-08-18 14:56:33 +00:00
|
|
|
uses: ./.github/workflows/reusable-dev-build.yml
|
|
|
|
with:
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-large }}
|
2023-08-18 14:56:33 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
uploaded-binary-name: 'consul-bin'
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-08-18 14:56:33 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
generate-envoy-job-matrices:
|
2024-07-05 19:19:23 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- get-envoy-versions
|
2023-08-18 14:56:33 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
name: Generate Envoy Job Matrices
|
|
|
|
outputs:
|
|
|
|
envoy-matrix: ${{ steps.set-matrix.outputs.envoy-matrix }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.branch }}
|
|
|
|
- name: Generate Envoy Job Matrix
|
|
|
|
id: set-matrix
|
|
|
|
env:
|
2024-07-05 19:19:23 +00:00
|
|
|
# TEST_SPLITS sets the number of test case splits to use in the matrix. This will be
|
|
|
|
# further multiplied in envoy-integration tests by the other dimensions in the matrix
|
|
|
|
# to determine the total number of runners used.
|
|
|
|
TEST_SPLITS: 4
|
2023-08-18 14:56:33 +00:00
|
|
|
JQ_SLICER: '[ inputs ] | [_nwise(length / $runnercount | floor)]'
|
|
|
|
run: |
|
|
|
|
NUM_DIRS=$(find ./test/integration/connect/envoy -mindepth 1 -maxdepth 1 -type d | wc -l)
|
|
|
|
|
2024-07-05 19:19:23 +00:00
|
|
|
if [ "$NUM_DIRS" -lt "$TEST_SPLITS" ]; then
|
|
|
|
echo "TEST_SPLITS is larger than the number of tests/packages to split."
|
|
|
|
TEST_SPLITS=$((NUM_DIRS-1))
|
2023-08-18 14:56:33 +00:00
|
|
|
fi
|
2024-07-05 19:19:23 +00:00
|
|
|
# fix issue where test splitting calculation generates 1 more split than TEST_SPLITS.
|
|
|
|
TEST_SPLITS=$((TEST_SPLITS-1))
|
2023-08-18 14:56:33 +00:00
|
|
|
{
|
|
|
|
echo -n "envoy-matrix="
|
|
|
|
find ./test/integration/connect/envoy -maxdepth 1 -type d -print0 \
|
|
|
|
| xargs -0 -n 1 basename \
|
2024-07-05 19:19:23 +00:00
|
|
|
| jq --raw-input --argjson runnercount "$TEST_SPLITS" "$JQ_SLICER" \
|
2023-08-18 14:56:33 +00:00
|
|
|
| jq --compact-output 'map(join("|"))'
|
|
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
|
|
|
|
envoy-integration-test:
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large ) }}
|
2023-08-18 14:56:33 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2024-07-05 19:19:23 +00:00
|
|
|
- get-envoy-versions
|
2023-08-18 14:56:33 +00:00
|
|
|
- generate-envoy-job-matrices
|
|
|
|
- dev-build
|
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
|
|
|
contents: read
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-07-05 19:19:23 +00:00
|
|
|
envoy-version: ${{ fromJSON(needs.get-envoy-versions.outputs.envoy-versions-json) }}
|
2023-08-18 14:56:33 +00:00
|
|
|
xds-target: ["server", "client"]
|
|
|
|
test-cases: ${{ fromJSON(needs.generate-envoy-job-matrices.outputs.envoy-matrix) }}
|
|
|
|
env:
|
|
|
|
ENVOY_VERSION: ${{ matrix.envoy-version }}
|
|
|
|
XDS_TARGET: ${{ matrix.xds-target }}
|
|
|
|
AWS_LAMBDA_REGION: us-west-2
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.branch }}
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-08-18 14:56:33 +00:00
|
|
|
|
|
|
|
- name: fetch binary
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
name: '${{ env.CONSUL_BINARY_UPLOAD_NAME }}'
|
|
|
|
path: ./bin
|
|
|
|
- name: restore mode+x
|
|
|
|
run: chmod +x ./bin/consul
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
|
2023-08-18 14:56:33 +00:00
|
|
|
|
|
|
|
- name: Docker build
|
|
|
|
run: docker build -t consul:local -f ./build-support/docker/Consul-Dev.dockerfile ./bin
|
|
|
|
|
|
|
|
- name: Envoy Integration Tests
|
|
|
|
env:
|
|
|
|
GOTESTSUM_JUNITFILE: ${{ env.TEST_RESULTS_DIR }}/results.xml
|
|
|
|
GOTESTSUM_FORMAT: standard-verbose
|
|
|
|
COMPOSE_INTERACTIVE_NO_CLI: 1
|
|
|
|
LAMBDA_TESTS_ENABLED: "true"
|
|
|
|
# tput complains if this isn't set to something.
|
|
|
|
TERM: ansi
|
|
|
|
run: |
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
echo "Running $(sed 's,|, ,g' <<< "${{ matrix.test-cases }}" |wc -w) subtests"
|
|
|
|
# shellcheck disable=SC2001
|
|
|
|
sed 's,|,\n,g' <<< "${{ matrix.test-cases }}"
|
|
|
|
go run gotest.tools/gotestsum@v${{env.GOTESTSUM_VERSION}} \
|
|
|
|
--debug \
|
|
|
|
--rerun-fails \
|
|
|
|
--rerun-fails-report=/tmp/gotestsum-rerun-fails \
|
|
|
|
--jsonfile /tmp/jsonfile/go-test.log \
|
|
|
|
--packages=./test/integration/connect/envoy \
|
|
|
|
-- -timeout=30m -tags integration -run="TestEnvoy/(${{ matrix.test-cases }})"
|
|
|
|
|
|
|
|
# NOTE: ENT specific step as we store secrets in Vault.
|
|
|
|
- name: Authenticate to Vault
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && endsWith(github.repository, '-enterprise') }}
|
2023-08-18 14:56:33 +00:00
|
|
|
id: vault-auth
|
|
|
|
run: vault-auth
|
|
|
|
|
|
|
|
# NOTE: ENT specific step as we store secrets in Vault.
|
|
|
|
- name: Fetch Secrets
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && endsWith(github.repository, '-enterprise') }}
|
2023-08-18 14:56:33 +00:00
|
|
|
id: secrets
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: hashicorp/vault-action@v3
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
url: ${{ steps.vault-auth.outputs.addr }}
|
|
|
|
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
|
|
|
|
token: ${{ steps.vault-auth.outputs.token }}
|
|
|
|
secrets: |
|
|
|
|
kv/data/github/${{ github.repository }}/datadog apikey | DATADOG_API_KEY;
|
|
|
|
|
|
|
|
- name: prepare datadog-ci
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && !endsWith(github.repository, '-enterprise') }}
|
2023-08-18 14:56:33 +00:00
|
|
|
run: |
|
|
|
|
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci"
|
|
|
|
chmod +x /usr/local/bin/datadog-ci
|
|
|
|
|
|
|
|
- name: upload coverage
|
|
|
|
# do not run on forks
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && github.event.pull_request.head.repo.full_name == github.repository }}
|
2023-08-18 14:56:33 +00:00
|
|
|
env:
|
|
|
|
DATADOG_API_KEY: "${{ endsWith(github.repository, '-enterprise') && env.DATADOG_API_KEY || secrets.DATADOG_API_KEY }}"
|
|
|
|
DD_ENV: ci
|
|
|
|
run: datadog-ci junit upload --service "$GITHUB_REPOSITORY" $TEST_RESULTS_DIR/results.xml
|
2024-07-05 19:19:23 +00:00
|
|
|
|
2023-08-18 14:56:33 +00:00
|
|
|
upgrade-integration-test:
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large ) }}
|
2023-08-18 14:56:33 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-08-18 14:56:33 +00:00
|
|
|
- dev-build
|
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
|
|
|
contents: read
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-07-05 19:19:23 +00:00
|
|
|
consul-version: ["1.17", "1.18", "1.19"]
|
2023-08-18 14:56:33 +00:00
|
|
|
env:
|
|
|
|
CONSUL_LATEST_VERSION: ${{ matrix.consul-version }}
|
2024-07-05 19:19:23 +00:00
|
|
|
# ENVOY_VERSION should be the latest version supported by _all_ Consul versions in the
|
|
|
|
# matrix.consul-version, since we are testing upgrade from an older Consul version.
|
|
|
|
# In practice, this should be the highest Envoy version supported by the lowest non-LTS
|
|
|
|
# Consul version in the matrix (LTS versions receive additional Envoy version support).
|
|
|
|
#
|
|
|
|
# This value should be kept current in new nightly test workflows, and updated any time
|
|
|
|
# a new major Envoy release is added to the set supported by Consul versions in
|
|
|
|
# matrix.consul-version (i.e. whenever the highest common Envoy version across active
|
|
|
|
# Consul versions changes). The minor Envoy version does not necessarily need to be
|
|
|
|
# kept current for the purpose of these tests, but the major (1.N) version should be.
|
|
|
|
ENVOY_VERSION: 1.27.6
|
2023-08-18 14:56:33 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.branch }}
|
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-08-18 14:56:33 +00:00
|
|
|
- run: go env
|
|
|
|
|
|
|
|
# Get go binary from workspace
|
|
|
|
- name: fetch binary
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
name: '${{ env.CONSUL_BINARY_UPLOAD_NAME }}'
|
|
|
|
path: .
|
|
|
|
- name: restore mode+x
|
|
|
|
run: chmod +x consul
|
|
|
|
- name: Build consul:local image
|
|
|
|
run: docker build -t ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local -f ./build-support/docker/Consul-Dev.dockerfile .
|
|
|
|
- name: Build consul-envoy:latest-version image
|
|
|
|
id: buildConsulEnvoyLatestImage
|
2023-08-21 14:07:49 +00:00
|
|
|
run: |
|
|
|
|
if ${{ endsWith(github.repository, '-enterprise') }} == 'true'
|
|
|
|
then
|
|
|
|
docker build -t consul-envoy:latest-version --build-arg CONSUL_IMAGE=docker.mirror.hashicorp.services/${{ env.CONSUL_LATEST_IMAGE_NAME }}:${{ env.CONSUL_LATEST_VERSION }}-ent --build-arg ENVOY_VERSION=${{ env.ENVOY_VERSION }} -f ./test/integration/consul-container/assets/Dockerfile-consul-envoy ./test/integration/consul-container/assets
|
|
|
|
else
|
|
|
|
docker build -t consul-envoy:latest-version --build-arg CONSUL_IMAGE=docker.mirror.hashicorp.services/${{ env.CONSUL_LATEST_IMAGE_NAME }}:${{ env.CONSUL_LATEST_VERSION }} --build-arg ENVOY_VERSION=${{ env.ENVOY_VERSION }} -f ./test/integration/consul-container/assets/Dockerfile-consul-envoy ./test/integration/consul-container/assets
|
|
|
|
fi
|
2023-08-18 14:56:33 +00:00
|
|
|
- name: Build consul-envoy:target-version image
|
|
|
|
id: buildConsulEnvoyTargetImage
|
|
|
|
continue-on-error: true
|
|
|
|
run: docker build -t consul-envoy:target-version --build-arg CONSUL_IMAGE=${{ env.CONSUL_LATEST_IMAGE_NAME }}:local --build-arg ENVOY_VERSION=${{ env.ENVOY_VERSION }} -f ./test/integration/consul-container/assets/Dockerfile-consul-envoy ./test/integration/consul-container/assets
|
|
|
|
- name: Retry Build consul-envoy:target-version image
|
|
|
|
if: steps.buildConsulEnvoyTargetImage.outcome == 'failure'
|
|
|
|
run: docker build -t consul-envoy:target-version --build-arg CONSUL_IMAGE=${{ env.CONSUL_LATEST_IMAGE_NAME }}:local --build-arg ENVOY_VERSION=${{ env.ENVOY_VERSION }} -f ./test/integration/consul-container/assets/Dockerfile-consul-envoy ./test/integration/consul-container/assets
|
|
|
|
- name: Build sds image
|
|
|
|
run: docker build -t consul-sds-server ./test/integration/connect/envoy/test-sds-server/
|
|
|
|
- name: Configure GH workaround for ipv6 loopback
|
|
|
|
if: ${{ !endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: |
|
|
|
|
cat /etc/hosts && echo "-----------"
|
|
|
|
sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6-localhost ip6-loopback/g' /etc/hosts
|
|
|
|
cat /etc/hosts
|
|
|
|
- name: Upgrade Integration Tests
|
|
|
|
run: |
|
|
|
|
mkdir -p "${{ env.TEST_RESULTS_DIR }}"
|
|
|
|
cd ./test/integration/consul-container/test/upgrade
|
|
|
|
docker run --rm ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local consul version
|
|
|
|
go run gotest.tools/gotestsum@v${{env.GOTESTSUM_VERSION}} \
|
|
|
|
--raw-command \
|
2023-11-20 16:39:51 +00:00
|
|
|
--format=github-actions \
|
|
|
|
--rerun-fails \
|
2023-08-18 14:56:33 +00:00
|
|
|
--packages="./..." \
|
|
|
|
-- \
|
|
|
|
go test \
|
|
|
|
-p=4 \
|
|
|
|
-tags "${{ env.GOTAGS }}" \
|
|
|
|
-timeout=30m \
|
|
|
|
-json \
|
|
|
|
./... \
|
|
|
|
--follow-log=false \
|
|
|
|
--target-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
|
|
|
|
--target-version local \
|
|
|
|
--latest-image docker.mirror.hashicorp.services/${{ env.CONSUL_LATEST_IMAGE_NAME }} \
|
|
|
|
--latest-version "${{ env.CONSUL_LATEST_VERSION }}"
|
|
|
|
ls -lrt
|
|
|
|
env:
|
|
|
|
# this is needed because of incompatibility between RYUK container and GHA
|
|
|
|
GOTESTSUM_JUNITFILE: ${{ env.TEST_RESULTS_DIR }}/results.xml
|
|
|
|
GOTESTSUM_FORMAT: standard-verbose
|
|
|
|
COMPOSE_INTERACTIVE_NO_CLI: 1
|
|
|
|
# tput complains if this isn't set to something.
|
|
|
|
TERM: ansi
|
|
|
|
# NOTE: ENT specific step as we store secrets in Vault.
|
|
|
|
- name: Authenticate to Vault
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && endsWith(github.repository, '-enterprise') }}
|
2023-08-18 14:56:33 +00:00
|
|
|
id: vault-auth
|
|
|
|
run: vault-auth
|
|
|
|
|
|
|
|
# NOTE: ENT specific step as we store secrets in Vault.
|
|
|
|
- name: Fetch Secrets
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && endsWith(github.repository, '-enterprise') }}
|
2023-08-18 14:56:33 +00:00
|
|
|
id: secrets
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: hashicorp/vault-action@v3
|
2023-08-18 14:56:33 +00:00
|
|
|
with:
|
|
|
|
url: ${{ steps.vault-auth.outputs.addr }}
|
|
|
|
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
|
|
|
|
token: ${{ steps.vault-auth.outputs.token }}
|
|
|
|
secrets: |
|
|
|
|
kv/data/github/${{ github.repository }}/datadog apikey | DATADOG_API_KEY;
|
|
|
|
|
|
|
|
- name: prepare datadog-ci
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && !endsWith(github.repository, '-enterprise') }}
|
2023-08-18 14:56:33 +00:00
|
|
|
run: |
|
|
|
|
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci"
|
|
|
|
chmod +x /usr/local/bin/datadog-ci
|
|
|
|
|
|
|
|
- name: upload coverage
|
|
|
|
# do not run on forks
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && github.event.pull_request.head.repo.full_name == github.repository }}
|
2023-08-18 14:56:33 +00:00
|
|
|
env:
|
|
|
|
DATADOG_API_KEY: "${{ endsWith(github.repository, '-enterprise') && env.DATADOG_API_KEY || secrets.DATADOG_API_KEY }}"
|
|
|
|
DD_ENV: ci
|
|
|
|
run: datadog-ci junit upload --service "$GITHUB_REPOSITORY" $TEST_RESULTS_DIR/results.xml
|
|
|
|
|
2023-11-16 00:32:37 +00:00
|
|
|
upgrade-integration-test-deployer:
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large ) }}
|
|
|
|
needs:
|
|
|
|
- setup
|
2024-01-08 22:18:41 +00:00
|
|
|
- get-go-version
|
2023-11-16 00:32:37 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write # NOTE: this permission is explicitly required for Vault auth.
|
|
|
|
contents: read
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2024-06-11 14:44:52 +00:00
|
|
|
consul-version: [ "1.17", "1.18"]
|
2023-11-16 00:32:37 +00:00
|
|
|
env:
|
|
|
|
CONSUL_LATEST_VERSION: ${{ matrix.consul-version }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
|
2023-11-16 00:32:37 +00:00
|
|
|
with:
|
|
|
|
ref: ${{ inputs.branch }}
|
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2024-05-14 19:49:03 +00:00
|
|
|
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
|
2023-11-16 00:32:37 +00:00
|
|
|
with:
|
2024-01-08 22:18:41 +00:00
|
|
|
go-version: ${{ needs.get-go-version.outputs.go-version }}
|
2023-11-16 00:32:37 +00:00
|
|
|
- run: go env
|
|
|
|
- name: Build image
|
|
|
|
run: make test-deployer-setup
|
|
|
|
- name: Upgrade Integration Tests
|
|
|
|
run: |
|
|
|
|
mkdir -p "${{ env.TEST_RESULTS_DIR }}"
|
2023-11-20 16:39:51 +00:00
|
|
|
#export NOLOGBUFFER=1
|
2023-11-16 00:32:37 +00:00
|
|
|
cd ./test-integ/upgrade
|
|
|
|
docker run --rm ${{ env.CONSUL_LATEST_IMAGE_NAME }}:local consul version
|
|
|
|
go run gotest.tools/gotestsum@v${{env.GOTESTSUM_VERSION}} \
|
|
|
|
--raw-command \
|
2023-11-20 16:39:51 +00:00
|
|
|
--format=github-actions \
|
2023-11-16 00:32:37 +00:00
|
|
|
--packages="./..." \
|
|
|
|
-- \
|
|
|
|
go test \
|
|
|
|
-tags "${{ env.GOTAGS }}" \
|
2023-11-17 17:34:30 +00:00
|
|
|
-timeout=20m \
|
2023-11-16 00:32:37 +00:00
|
|
|
-parallel=2 \
|
|
|
|
-json \
|
|
|
|
./... \
|
|
|
|
--target-image ${{ env.CONSUL_LATEST_IMAGE_NAME }} \
|
|
|
|
--target-version local \
|
|
|
|
--latest-image docker.mirror.hashicorp.services/${{ env.CONSUL_LATEST_IMAGE_NAME }} \
|
|
|
|
--latest-version "${{ env.CONSUL_LATEST_VERSION }}"
|
|
|
|
env:
|
|
|
|
# this is needed because of incompatibility between RYUK container and GHA
|
|
|
|
GOTESTSUM_JUNITFILE: ${{ env.TEST_RESULTS_DIR }}/results.xml
|
|
|
|
GOTESTSUM_FORMAT: standard-verbose
|
|
|
|
COMPOSE_INTERACTIVE_NO_CLI: 1
|
|
|
|
# tput complains if this isn't set to something.
|
|
|
|
TERM: ansi
|
|
|
|
# NOTE: ENT specific step as we store secrets in Vault.
|
|
|
|
- name: Authenticate to Vault
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && endsWith(github.repository, '-enterprise') }}
|
2023-11-16 00:32:37 +00:00
|
|
|
id: vault-auth
|
|
|
|
run: vault-auth
|
|
|
|
|
|
|
|
# NOTE: ENT specific step as we store secrets in Vault.
|
|
|
|
- name: Fetch Secrets
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && endsWith(github.repository, '-enterprise') }}
|
2023-11-16 00:32:37 +00:00
|
|
|
id: secrets
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: hashicorp/vault-action@v3
|
2023-11-16 00:32:37 +00:00
|
|
|
with:
|
|
|
|
url: ${{ steps.vault-auth.outputs.addr }}
|
|
|
|
caCertificate: ${{ steps.vault-auth.outputs.ca_certificate }}
|
|
|
|
token: ${{ steps.vault-auth.outputs.token }}
|
|
|
|
secrets: |
|
|
|
|
kv/data/github/${{ github.repository }}/datadog apikey | DATADOG_API_KEY;
|
|
|
|
|
|
|
|
- name: prepare datadog-ci
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && !endsWith(github.repository, '-enterprise') }}
|
2023-11-16 00:32:37 +00:00
|
|
|
run: |
|
|
|
|
curl -L --fail "https://github.com/DataDog/datadog-ci/releases/latest/download/datadog-ci_linux-x64" --output "/usr/local/bin/datadog-ci"
|
|
|
|
chmod +x /usr/local/bin/datadog-ci
|
|
|
|
|
|
|
|
- name: upload coverage
|
|
|
|
# do not run on forks
|
2023-12-14 23:13:04 +00:00
|
|
|
if: ${{ !cancelled() && github.event.pull_request.head.repo.full_name == github.repository }}
|
2023-11-16 00:32:37 +00:00
|
|
|
env:
|
|
|
|
DATADOG_API_KEY: "${{ endsWith(github.repository, '-enterprise') && env.DATADOG_API_KEY || secrets.DATADOG_API_KEY }}"
|
|
|
|
DD_ENV: ci
|
|
|
|
run: datadog-ci junit upload --service "$GITHUB_REPOSITORY" $TEST_RESULTS_DIR/results.xml
|
|
|
|
|
2023-08-18 14:56:33 +00:00
|
|
|
test-integrations-success:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
- generate-envoy-job-matrices
|
|
|
|
- envoy-integration-test
|
|
|
|
- upgrade-integration-test
|
2023-11-16 21:31:18 +00:00
|
|
|
- upgrade-integration-test-deployer
|
2023-08-18 14:56:33 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
if: ${{ always() }}
|
|
|
|
steps:
|
|
|
|
- name: evaluate upstream job results
|
|
|
|
run: |
|
|
|
|
# exit 1 if failure or cancelled result for any upstream job
|
|
|
|
if printf '${{ toJSON(needs) }}' | grep -E -i '\"result\": \"(failure|cancelled)\"'; then
|
|
|
|
printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}"
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-08-25 13:39:08 +00:00
|
|
|
- name: Notify Slack
|
|
|
|
if: ${{ failure() }}
|
|
|
|
id: slack
|
2024-05-14 19:49:03 +00:00
|
|
|
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
|
2023-08-25 13:39:08 +00:00
|
|
|
with:
|
|
|
|
payload: |
|
|
|
|
{
|
|
|
|
"message": "One or more nightly integration tests have failed. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
|
|
}
|
|
|
|
env:
|
|
|
|
SLACK_WEBHOOK_URL: ${{ secrets.CONSUL_NIGHTLY_INTEG_TEST_SLACK_WEBHOOK }}
|