Skip to content

Commit

Permalink
backport of commit 71045d9
Browse files Browse the repository at this point in the history
  • Loading branch information
nathancoleman committed Nov 2, 2022
1 parent 706fa94 commit 1c44dc2
Show file tree
Hide file tree
Showing 288 changed files with 20,752 additions and 22,150 deletions.
335 changes: 230 additions & 105 deletions .circleci/config.yml

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Consul Community Support
url: https://discuss.hashicorp.com/c/consul/29
about: If you have a question or are looking for advice on Consul K8s, please post on our Discuss forum! The community loves to chime in to help. Happy Coding!
- name: Consul on Kubernetes Learn Tutorials
url: https://learn.hashicorp.com/collections/consul/kubernetes
about: Please check out our Learn Tutorials. These hands on tutorials deal with many of the tasks common to using Consul on Kubernetes.
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
outputs:
go-version: ${{ steps.get-go-version.outputs.go-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Determine Go version
id: get-go-version
# We use .go-version as our source of truth for current Go
Expand All @@ -33,7 +33,7 @@ jobs:
outputs:
product-version: ${{ steps.get-product-version.outputs.product-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: get product version
id: get-product-version
run: |
Expand All @@ -47,15 +47,15 @@ jobs:
filepath: ${{ steps.generate-metadata-file.outputs.filepath }}
steps:
- name: "Checkout directory"
uses: actions/checkout@v3
uses: actions/checkout@v2
- name: Generate metadata file
id: generate-metadata-file
uses: hashicorp/actions-generate-metadata@v1
with:
version: ${{ needs.get-product-version.outputs.product-version }}
product: ${{ env.PKG_NAME }}
repositoryOwner: "hashicorp"
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v2
with:
name: metadata.json
path: ${{ steps.generate-metadata-file.outputs.filepath }}
Expand Down Expand Up @@ -107,10 +107,10 @@ jobs:

name: Go ${{ matrix.go }} ${{ matrix.goos }} ${{ matrix.goarch }} ${{ matrix.component }} build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}

Expand All @@ -132,7 +132,7 @@ jobs:
zip -r -j out/${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip dist/
- name: Upload built binaries
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
path: ${{ matrix.component}}/out/${{ matrix.pkg_name }}_${{ needs.get-product-version.outputs.product-version }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
echo "Test PASSED, expected: ${VERSION}, got: ${CONSUL_K8S_VERSION}"
- name: Upload rpm package
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}}
with:
name: ${{ env.RPM_PACKAGE }}
Expand All @@ -202,7 +202,7 @@ jobs:
echo "Test PASSED, expected: ${VERSION}, got: ${CONSUL_K8S_VERSION}"
- name: Upload debian packages
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
if: ${{ matrix.goos == 'linux' && matrix.component == 'cli' && matrix.goarch == 'amd64'}}
with:
name: ${{ env.DEB_PACKAGE }}
Expand All @@ -219,7 +219,7 @@ jobs:
repo: ${{ github.event.repository.name }}
version: ${{ needs.get-product-version.outputs.product-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: consul-cni_${{ needs.get-product-version.outputs.product-version }}_linux_${{ matrix.arch }}.zip
Expand Down Expand Up @@ -263,7 +263,7 @@ jobs:
repo: ${{ github.event.repository.name }}
version: ${{ needs.get-product-version.outputs.product-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: consul-cni_${{ needs.get-product-version.outputs.product-version }}_linux_${{ matrix.arch }}.zip
Expand All @@ -274,9 +274,9 @@ jobs:
run: |
cd "${ZIP_LOCATION}"
unzip -j *.zip
- name: Copy LICENSE
- name: Copy LICENSE.md
run:
cp LICENSE ./control-plane
cp LICENSE.md ./control-plane
- uses: hashicorp/actions-docker-build@v1
with:
smoke_test: |
Expand All @@ -292,7 +292,7 @@ jobs:
pkg_name: consul-k8s-control-plane_${{ env.version }}
bin_name: consul-k8s-control-plane
workdir: control-plane
redhat_tag: quay.io/redhat-isv-containers/611ca2f89a9b407267837100:${{env.version}}-ubi
redhat_tag: scan.connect.redhat.com/ospid-611ca2f89a9b407267837100/consul-k8s-control-plane:${{env.version}}-ubi

build-docker-ubi-dockerhub:
name: Docker ${{ matrix.arch }} UBI build for DockerHub
Expand All @@ -305,7 +305,7 @@ jobs:
repo: ${{ github.event.repository.name }}
version: ${{ needs.get-product-version.outputs.product-version }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: actions/download-artifact@v3
with:
name: consul-cni_${{ needs.get-product-version.outputs.product-version }}_linux_${{ matrix.arch }}.zip
Expand All @@ -316,9 +316,9 @@ jobs:
run: |
cd ${ZIP_LOCATION}
unzip -j *.zip
- name: Copy LICENSE
- name: Copy LICENSE.md
run:
cp LICENSE ./control-plane
cp LICENSE.md ./control-plane
- uses: hashicorp/actions-docker-build@v1
with:
smoke_test: |
Expand Down
70 changes: 22 additions & 48 deletions .github/workflows/reusable-acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ on:
type: string
default: ""
consul-k8s-image:
required: false
required: false
type: string
default: docker.mirror.hashicorp.services/hashicorpdev/consul-k8s-control-plane:latest
directory:
required: true
type: string
Expand All @@ -25,50 +26,40 @@ on:
kind-version:
required: false
type: string
default: "v1.24.6"
checkout-ref:
required: false
type: string
default: ${{ github.sha }}
default: "v1.22.4"
secrets:
CONSUL_ENT_LICENSE:
required: true

# Environment variables can only be used at the step level
env:
TEST_RESULTS: /tmp/test-results # path to where test results are saved
CONSUL_ENT_LICENSE: ${{ secrets.CONSUL_ENT_LICENSE }}
CONSUL_K8S_IMAGE: ${{ inputs.consul-k8s-image }}
CONSUL_ENT_LICENSE: ${{ secrets.CONSUL_ENT_LICENSE }}

jobs:
job:
runs-on: [custom, linux, xl]
runs-on: ubuntu-latest
strategy:
matrix:
include:
- {runner: "0", test-packages: "basic consul-dns metrics"}
- {runner: "1", test-packages: "connect"}
- {runner: "2", test-packages: "controller example"}
- {runner: "3", test-packages: "ingress-gateway"}
- {runner: "4", test-packages: "partitions"}
- {runner: "5", test-packages: "peering"}
- {runner: "6", test-packages: "snapshot-agent vault wan-federation"}
- {runner: "7", test-packages: "cli sync terminating-gateway"}
include: # I am really sorry for this but I could not find a way to automatically split our tests into several runners. For now, split manually.
- {runner: "0", test-packages: "basic connect consul-dns"}
- {runner: "1", test-packages: "controller example ingress-gateway"}
- {runner: "2", test-packages: "mesh-gateway metrics"}
- {runner: "3", test-packages: "partitions sync terminating-gateway"}
- {runner: "4", test-packages: "vault"}

fail-fast: false
fail-fast: true
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ inputs.checkout-ref }}
uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v2
with:
go-version: ${{ inputs.go-version }}

- name: Setup go mod cache
uses: actions/cache@v3
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
Expand All @@ -77,23 +68,11 @@ jobs:
restore-keys: |
${{ runner.os }}-go-
- name: Install pre-requisites # Install gotestsum, kind, kubectl, and helm
- name: Install gotestsum
run: |
wget https://github.com/gotestyourself/gotestsum/releases/download/v1.6.4/gotestsum_1.6.4_linux_amd64.tar.gz
sudo tar -C /usr/local/bin -xzf gotestsum_1.6.4_linux_amd64.tar.gz
rm gotestsum_1.6.4_linux_amd64.tar.gz
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.15.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
curl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
wget https://get.helm.sh/helm-v3.9.4-linux-amd64.tar.gz
tar -zxvf helm-v3.9.4-linux-amd64.tar.gz
sudo mv linux-amd64/helm /usr/local/bin/helm
wget https://github.com/gotestyourself/gotestsum/releases/download/v"${{ inputs.gotestsum-version }}"/gotestsum_"${{ inputs.gotestsum-version }}"_linux_amd64.tar.gz
sudo tar -C /usr/local/bin -xzf gotestsum_"${{ inputs.gotestsum-version }}"_linux_amd64.tar.gz
rm gotestsum_"${{ inputs.gotestsum-version }}"_linux_amd64.tar.gz
- run: mkdir -p ${{ env.TEST_RESULTS }}

Expand All @@ -106,11 +85,6 @@ jobs:
kind create cluster --name dc1 --image kindest/node:${{ inputs.kind-version }}
kind create cluster --name dc2 --image kindest/node:${{ inputs.kind-version }}
- name: Build CLI
run: |
sudo make cli-dev
consul-k8s version
# We have to run the tests for each package separately so that we can
# exit early if any test fails (-failfast only works within a single
# package).
Expand Down Expand Up @@ -141,14 +115,14 @@ jobs:
- name: Upload tests
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.name }}-${{ matrix.test-packages }}-gotestsum-report.xml
path: ${{ env.TEST_RESULTS }}/gotestsum-report.xml

- name: Upload debug (on failure)
- name: Upload debug (on failure)
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v2
with:
name: ${{ inputs.name }}-${{ matrix.test-packages }}-debug-info
path: ${{ env.TEST_RESULTS }}/debug
8 changes: 4 additions & 4 deletions .github/workflows/reusable-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ on:
# Environment variables can only be used at the step level
env:
TEST_RESULTS: /tmp/test-results # path to where test results are saved
GOTESTSUM_VERSION: 1.8.2
GOTESTSUM_VERSION: 1.8.1

jobs:
job:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v2

- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v2
with:
go-version: ${{inputs.go-version}}

- name: Setup go mod cache
uses: actions/cache@v3
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
Expand Down
Loading

0 comments on commit 1c44dc2

Please sign in to comment.