Support index alias update (#212) #469
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [push, pull_request] | |
name: Test | |
jobs: | |
lint: | |
# Separate golangci-lint into its own job because it can override go | |
# env variables and it runs jobs in parallel: | |
# https://github.com/golangci/golangci-lint-action#how-to-use | |
name: Runs go linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.1 | |
- uses: actions/checkout@v4 | |
with: | |
# we depend on full git history for linters | |
fetch-depth: 0 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Required: the version of golangci-lint is required and must be | |
# specified without patch version: we always use the latest patch | |
# version. | |
version: v1.54 | |
args: --verbose --timeout=10m | |
test: | |
strategy: | |
matrix: | |
go-version: [1.22.1] | |
os: [ubuntu-latest] | |
os-major-version: | |
- "2-opensearch" | |
include: | |
- os-major-version: "2-opensearch" | |
version: 2 | |
oss-image: "opensearchproject/opensearch" | |
OS_IMAGE: "opensearchproject/opensearch:2" | |
OS_DASHBOARD_IMAGE: "opensearchproject/opensearch-dashboards:2" | |
OPENSEARCH_PREFIX: "plugins.security" | |
needs: [lint] | |
name: Test against OS ${{ matrix.os-major-version }} on ${{ matrix.go-version }}/${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
env: | |
OS_IMAGE: "${{matrix.OS_IMAGE}}" | |
OS_DASHBOARD_IMAGE: "${{matrix.OS_DASHBOARD_IMAGE}}" | |
OPENSEARCH_PREFIX: "${{matrix.OPENSEARCH_PREFIX}}" | |
OSS_ENV_VAR: "${{matrix.OSS_ENV_VAR}}" | |
steps: | |
- name: Prepare tests | |
run: | | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# we depend on full git history for linters | |
fetch-depth: 0 | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod # Module download cache | |
~/.cache/go-build # Build cache (Linux) | |
~/Library/Caches/go-build # Build cache (Mac) | |
'%LocalAppData%\go-build' # Build cache (Windows) | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
- name: Run Docker containers | |
run: docker compose up --detach | |
env: | |
OSS_IMAGE: "${{ matrix.oss-image }}:${{ matrix.version }}" | |
OS_COMMAND: "${{matrix.OS_COMMAND}}" | |
- name: Check Docker containers | |
run: docker ps -a | |
# While docker/OS is booting up, run the linters | |
- name: Install managed version of terraform | |
uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: 1.1.7 | |
terraform_wrapper: false | |
- name: Terraform fmt | |
id: fmt | |
run: terraform fmt -check | |
continue-on-error: false | |
- name: Terraform Validate | |
id: validate | |
run: terraform validate -no-color | |
- name: Run check scripts | |
run: | | |
./script/test-mod-tidy | |
- name: Wait for OpenSearch | |
# ensure that OS has come up and is available | |
run: | | |
./script/wait-for-endpoint --timeout=60 http://admin:myStrongPassword123%40456@localhost:9200 | |
- name: Dump docker logs on failure | |
if: failure() | |
uses: jwalton/gh-docker-logs@v2 | |
- name: Run the tests | |
run: | | |
export OPENSEARCH_URL=http://admin:myStrongPassword123%40456@localhost:9200 | |
export TF_LOG=INFO | |
TF_ACC=1 go test ./... -v -parallel 20 -cover -short | |
# check goreleaser config for deprecations | |
curl -sfL https://git.io/goreleaser | sh -s -- check | |
release: | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [test] | |
runs-on: ubuntu-latest | |
name: Release | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.1 | |
- name: Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v6 | |
with: | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |