Skip to content

Commit

Permalink
feat: Upgrade to go 1.17, migrate to github action, upgrade to EK 7.16 (
Browse files Browse the repository at this point in the history
#24)

Signed-off-by: disaster37 <[email protected]>
  • Loading branch information
disaster37 authored Jan 10, 2022
1 parent 68de96d commit df797b8
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 215 deletions.
76 changes: 0 additions & 76 deletions .circleci/config.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/release.yml

This file was deleted.

73 changes: 73 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: 'build'

on:
push:
branches:
- main
- 7.x
tags:
- '*'
pull_request:
branches:
- main
- 7.x

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Setup Elasticsearch / Kibana
run: |
set -e
docker-compose up -d
until $(curl --output /dev/null --silent --head --fail -u elastic:changeme http://localhost:9200); do sleep 5; done
until $(curl --output /dev/null --silent --head --fail -u elastic:changeme http://localhost:5601); do sleep 5; done
curl -XPOST -u elastic:changeme http://localhost:9200/_license/start_trial?acknowledge=true
sleep 10
- name: Run build
run: make build
- name: Run acceptance tests
run: KIBANA_URL="http://localhost:5601" KIBANA_USERNAME="elastic" KIBANA_PASSWORD="changeme" make testacc
- uses: codecov/codecov-action@v2
with:
files: coverage.out
flags: unittests
fail_ci_if_error: true

goreleaser:
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
-
name: Import GPG key
id: import_gpg
uses: paultyng/[email protected]
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
PASSPHRASE: ${{ secrets.PASSPHRASE }}
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
dist/

coverage.txt
cover.out
coverage.out
terraform-provider-kibana

# terraform
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test: fmtcheck
go test $(TEST) -timeout=30s -parallel=4

testacc: fmt fmtcheck
KIBANA_URL=${KIBANA_URL} KIBANA_USERNAME=${KIBANA_USERNAME} KIBANA_PASSWORD=${KIBANA_PASSWORD} TF_ACC=1 TF_LOG_PROVIDER=DEBUG go test $(TEST) -v -count 1 -parallel 1 -race -coverprofile=coverage.txt -covermode=atomic $(TESTARGS) -timeout 120m
KIBANA_URL=${KIBANA_URL} KIBANA_USERNAME=${KIBANA_USERNAME} KIBANA_PASSWORD=${KIBANA_PASSWORD} TF_ACC=1 TF_LOG_PROVIDER=DEBUG go test $(TEST) -v -count 1 -parallel 1 -race -coverprofile=coverage.out -covermode=atomic $(TESTARGS) -timeout 120m

fmt:
@echo "==> Fixing source code with gofmt..."
Expand Down
81 changes: 16 additions & 65 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,25 @@ version: '3'

services:
elasticsearch:
image: ${ES_OSS_IMAGE}
image: docker.elastic.co/elasticsearch/elasticsearch:7.16.2
hostname: elasticsearch
environment:
- cluster.name=elasticsearch
- bootstrap.memory_lock=true
- discovery.type=single-node
- path.repo=/tmp
- network.publish_host=127.0.0.1
- logger.org.elasticsearch=warn
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
command: ${ES_COMMAND}
ulimits:
nproc: 65536
nofile:
soft: 65536
hard: 65536
memlock:
soft: -1
hard: -1
cluster.name: test
discovery.type: "single-node"
ELASTIC_PASSWORD: "changeme"
xpack.security.enabled: "true"
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
path.repo: "/tmp"
ports:
- 9200:9200
xpack:
image: ${ES_IMAGE}
hostname: elasticsearch-xpack
kibana:
image: docker.elastic.co/kibana/kibana:7.16.2
hostname: kibana
depends_on:
- "elasticsearch"
environment:
- cluster.name=xpack
- bootstrap.memory_lock=true
- discovery.type=single-node
- path.repo=/tmp
- xpack.license.self_generated.type=trial
- xpack.security.enabled=true
- xpack.watcher.enabled=true
- http.port=9210
- network.publish_host=127.0.0.1
- logger.org.elasticsearch=warn
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- ELASTIC_PASSWORD=elastic
ulimits:
nproc: 65536
nofile:
soft: 65536
hard: 65536
memlock:
soft: -1
hard: -1
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
ELASTICSEARCH_USERNAME: elastic
ELASTICSEARCH_PASSWORD: changeme
ports:
- 9210:9210
opendistro:
image: ${ES_OPENDISTRO_IMAGE:-rwgrim/docker-noop}
hostname: elasticsearch-opendistro
environment:
- cluster.name=opendistro
- bootstrap.memory_lock=true
- discovery.type=single-node
- path.repo=/tmp
- opendistro_security.disabled=true
- http.port=9220
- network.publish_host=127.0.0.1
- logger.org.elasticsearch=warn
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- ELASTIC_PASSWORD=elastic
ulimits:
nproc: 65536
nofile:
soft: 65536
hard: 65536
memlock:
soft: -1
hard: -1
ports:
- 9220:9220
- 5601:5601
57 changes: 54 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,64 @@
module github.com/disaster37/terraform-provider-kibana/v7

go 1.16
go 1.17

require (
github.com/disaster37/go-kibana-rest/v7 v7.12.1-3
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.1
github.com/onsi/gomega v1.16.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
github.com/x-cray/logrus-prefixed-formatter v0.5.2
)

require (
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg v1.0.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/go-resty/resty/v2 v2.6.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v0.16.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.1 // indirect
github.com/hashicorp/go-uuid v1.0.2 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hashicorp/hc-install v0.3.1 // indirect
github.com/hashicorp/hcl/v2 v2.3.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.15.0 // indirect
github.com/hashicorp/terraform-json v0.13.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.5.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.2.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/onsi/ginkgo v1.16.4 // indirect
github.com/onsi/gomega v1.16.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.9.1 // indirect
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect
google.golang.org/grpc v1.32.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
)
Loading

0 comments on commit df797b8

Please sign in to comment.