Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference ECS release candidate images for examples and submodules #214

Merged
merged 10 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/reusable-ecs-acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: reusable-ecs-acceptance

on:
workflow_call:
inputs:
name:
description: "The name of the job that runs the tests"
required: true
type: string
go-version:
description: "Version of Go to use to run the tests"
required: true
type: string
launch-type:
description: "The ECS launch type. Can be either EC2 or FARGATE"
required: false
type: string
default: "FARGATE"
consul-version:
required: false
type: string
default: "1.16.2"
enable-hcp:
description: "Whether to create a HCP cluster for running acceptance tests"
required: true
type: boolean


env:
TEST_RESULTS: /tmp/test-results
GOTESTSUM_VERSION: 1.8.0
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }}
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}

jobs:
acceptance-tests:
name: ${{ inputs.name }}
runs-on: ['ubuntu-latest']
defaults:
run:
working-directory: ./test/acceptance
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ inputs.go-version }}
cache-dependency-path: ./test/acceptance/go.sum
- name: Install base apps
run: |
sudo apt-get install -y expect openssl jq
- name: Install gotestsum
run: |
curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v${{ env.GOTESTSUM_VERSION }}/gotestsum_${{ env.GOTESTSUM_VERSION }}_linux_amd64.tar.gz" | \
tar -xz --overwrite -C /usr/local/bin gotestsum
- name: Install AWS CLI
run: |
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"
sudo dpkg -i session-manager-plugin.deb
aws --version
echo session-manager-plugin version "$(session-manager-plugin --version)"
- name: Install AWS ECS CLI
run: |
curl -sSL "https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-amd64-latest" -o /usr/local/bin/ecs-cli
chmod +x /usr/local/bin/ecs-cli
ecs-cli --version
- name: Assume AWS IAM Role
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 # v4.0.0
with:
role-to-assume: ${{ secrets.AWS_ECS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_ECS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ECS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ECS_SECRET_ACCESS_KEY }}
role-duration-seconds: 7200
- name: terraform init & apply
run: |
cd setup-terraform/
VARS="-var tags={\"build_url\":\"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}"
VARS+=' -var launch_type=${{ inputs.launch-type }}'
VARS+=' -var consul_version=${{ inputs.consul-version }}'
VARS+=' -var hcp_project_id=${{ secrets.HCP_PROJECT_ID }}'
case $GITHUB_REF_NAME in
main | release/*) VARS+=" -var enable_hcp=${{ inputs.enable-hcp }}";;
*) VARS+=" -var enable_hcp=false";;
esac
terraform init
terraform apply -auto-approve $VARS
- name: Acceptance tests
run: |
mkdir -p "$TEST_RESULTS"
cd tests/
gotestsum --junitfile "$TEST_RESULTS/gotestsum-report.xml" --format standard-verbose -- ./... -p 1 -timeout 1h -v -failfast
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: acceptance-test-results
path: ${{ env.TEST_RESULTS }}/gotestsum-report.xml
- name: terraform destroy
if: always()
run: |
cd setup-terraform/
VARS="-var tags={\"build_url\":\"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}"
VARS+=' -var launch_type=${{ inputs.launch-type }}'
VARS+=' -var consul_version=${{ inputs.consul-version }}'
VARS+=' -var hcp_project_id=${{ secrets.HCP_PROJECT_ID }}'
case $GITHUB_REF_NAME in
main | release/*) VARS+=" -var enable_hcp=${{ inputs.enable-hcp }}";;
*) VARS+=" -var enable_hcp=false";;
esac
terraform destroy -auto-approve $VARS
128 changes: 34 additions & 94 deletions .github/workflows/terraform-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ on:
branches:
- 'main'
- 'release/**'
env:
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }}
HCP_CLIENT_ID: ${{ secrets.HCP_CLIENT_ID }}
HCP_CLIENT_SECRET: ${{ secrets.HCP_CLIENT_SECRET }}

permissions: {}
jobs:
action-lint:
Expand Down Expand Up @@ -86,117 +83,60 @@ jobs:
terraform_version: 1.4.2
- name: Validate
run: terraform fmt -check -recursive .
acceptance:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
env:
TEST_RESULTS: /tmp/test-results
GOTESTSUM_VERSION: 1.8.0
acceptance-fargate:
needs:
- get-go-version
- terraform-fmt
- go-fmt-and-lint-acceptance
defaults:
run:
working-directory: ./test/acceptance
strategy:
# We have a limit of 6 HCP Consul clusters.
# The following controls whether to enable HCP when testing release branches.
# HCP is always disabled for tests on PRs.
matrix:
name:
- acceptance-1.16-FARGATE-HCP
- acceptance-1.16-EC2-HCP
- acceptance-1.16-FARGATE
- acceptance-1.16-EC2
include:
- name: acceptance-1.16-FARGATE-HCP
consul-version: '1.16.1'
enable-hcp: true
launch-type: FARGATE

- name: acceptance-1.16-EC2-HCP
consul-version: '1.16.1'
enable-hcp: true
launch-type: EC2

- name: acceptance-1.16-FARGATE
consul-version: '1.16.1'
enable-hcp: false
launch-type: FARGATE
fail-fast: false
uses: ./.github/workflows/reusable-ecs-acceptance.yml
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
name: ${{ matrix.name }}
launch-type: ${{ matrix.launch-type }}
enable-hcp: ${{ matrix.enable-hcp }}
secrets: inherit
acceptance-ec2:
needs:
- get-go-version
- acceptance-fargate
strategy:
# We have a limit of 6 HCP Consul clusters.
# The following controls whether to enable HCP when testing release branches.
# HCP is always disabled for tests on PRs.
matrix:
name:
- acceptance-1.16-EC2-HCP
- acceptance-1.16-EC2
include:
- name: acceptance-1.16-EC2-HCP
enable-hcp: true
launch-type: EC2

- name: acceptance-1.16-EC2
consul-version: '1.16.1'
enable-hcp: false
launch-type: EC2

steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Setup Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
cache-dependency-path: ./test/acceptance/go.sum
- name: Install base apps
run: |
sudo apt-get install -y expect openssl jq
- name: Install gotestsum
run: |
curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v${{ env.GOTESTSUM_VERSION }}/gotestsum_${{ env.GOTESTSUM_VERSION }}_linux_amd64.tar.gz" | \
tar -xz --overwrite -C /usr/local/bin gotestsum
- name: Install AWS CLI
run: |
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o "session-manager-plugin.deb"
sudo dpkg -i session-manager-plugin.deb
aws --version
echo session-manager-plugin version "$(session-manager-plugin --version)"
- name: Install AWS ECS CLI
run: |
curl -sSL "https://amazon-ecs-cli.s3.amazonaws.com/ecs-cli-linux-amd64-latest" -o /usr/local/bin/ecs-cli
chmod +x /usr/local/bin/ecs-cli
ecs-cli --version
- name: Assume AWS IAM Role
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 # v4.0.0
with:
role-to-assume: ${{ secrets.AWS_ECS_ROLE_ARN }}
aws-region: ${{ secrets.AWS_ECS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ECS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_ECS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
- name: terraform init & apply
run: |
cd setup-terraform/
VARS="-var tags={\"build_url\":\"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}"
VARS+=' -var launch_type=${{ matrix.launch-type }}'
VARS+=' -var consul_version=${{ matrix.consul-version }}'
VARS+=' -var hcp_project_id=${{ secrets.HCP_PROJECT_ID }}'
case $GITHUB_REF_NAME in
main | release/*) VARS+=" -var enable_hcp=${{ matrix.enable-hcp }}";;
*) VARS+=" -var enable_hcp=false";;
esac
terraform init
terraform apply -auto-approve $VARS
- name: Acceptance tests
run: |
mkdir -p "$TEST_RESULTS"
cd tests/
gotestsum --junitfile "$TEST_RESULTS/gotestsum-report.xml" --format standard-verbose -- ./... -p 1 -timeout 1h -v -failfast
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
if: always()
with:
name: acceptance-test-results
path: ${{ env.TEST_RESULTS }}/gotestsum-report.xml
- name: terraform destroy
if: always()
run: |
cd setup-terraform/
VARS="-var tags={\"build_url\":\"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\"}"
VARS+=' -var launch_type=${{ matrix.launch-type }}'
VARS+=' -var consul_version=${{ matrix.consul-version }}'
VARS+=' -var hcp_project_id=${{ secrets.HCP_PROJECT_ID }}'
case $GITHUB_REF_NAME in
main | release/*) VARS+=" -var enable_hcp=${{ matrix.enable-hcp }}";;
*) VARS+=" -var enable_hcp=false";;
esac
terraform destroy -auto-approve $VARS
fail-fast: false
uses: ./.github/workflows/reusable-ecs-acceptance.yml
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
name: ${{ matrix.name }}
launch-type: ${{ matrix.launch-type }}
enable-hcp: ${{ matrix.enable-hcp }}
secrets: inherit
2 changes: 1 addition & 1 deletion examples/admin-partitions/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "tags" {
variable "consul_ecs_image" {
description = "Consul ECS image to use."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
Ganeshrockz marked this conversation as resolved.
Show resolved Hide resolved
}

variable "consul_dataplane_image" {
Expand Down
2 changes: 1 addition & 1 deletion examples/cluster-peering/gateway/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ variable "additional_task_role_policies" {
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}
2 changes: 1 addition & 1 deletion examples/cluster-peering/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variable "lb_ingress_ip" {
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_startup_timeout" {
Expand Down
2 changes: 1 addition & 1 deletion examples/mesh-gateways/gateway/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,5 @@ variable "additional_task_role_policies" {
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}
2 changes: 1 addition & 1 deletion examples/mesh-gateways/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variable "lb_ingress_ip" {
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_startup_timeout" {
Expand Down
2 changes: 1 addition & 1 deletion examples/service-sameness/gateway/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ variable "additional_task_role_policies" {
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_lb_dns_name" {
Expand Down
2 changes: 1 addition & 1 deletion examples/service-sameness/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ variable "lb_ingress_ip" {
variable "consul_ecs_image" {
description = "Consul ECS image to use in all tasks."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_startup_timeout" {
Expand Down
2 changes: 1 addition & 1 deletion modules/controller/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
variable "consul_ecs_image" {
description = "consul-ecs Docker image."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "ecs_cluster_arn" {
Expand Down
2 changes: 1 addition & 1 deletion modules/gateway-task/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ variable "skip_server_watch" {
variable "consul_ecs_image" {
description = "consul-ecs Docker image."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_dataplane_image" {
Expand Down
2 changes: 1 addition & 1 deletion modules/mesh-task/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ variable "outbound_only" {
variable "consul_ecs_image" {
description = "consul-ecs Docker image."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_dataplane_image" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ variable "launch_type" {
variable "consul_ecs_image" {
description = "Consul ECS image to use."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "server_service_name" {
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/tests/hcp/terraform/ap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ variable "consul_image" {
variable "consul_ecs_image" {
description = "Consul ECS image to use."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_address" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ variable "consul_image" {
variable "consul_ecs_image" {
description = "Consul ECS image to use."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_address" {
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/tests/hcp/terraform/ns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ variable "consul_image" {
variable "consul_ecs_image" {
description = "Consul ECS image to use."
type = string
default = "hashicorpdev/consul-ecs:latest"
default = "hashicorppreview/consul-ecs:0.7.0-rc1"
}

variable "consul_server_address" {
Expand Down