Skip to content

Commit

Permalink
feat: http server & telemetry support
Browse files Browse the repository at this point in the history
  • Loading branch information
spy16 committed Sep 15, 2022
1 parent 95532d0 commit 5441dec
Show file tree
Hide file tree
Showing 28 changed files with 3,569 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Lint
on: [ push, pull_request, workflow_dispatch ]

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: "1.18"
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
skip-go-installation: true
version: v1.46.2
args: --timeout=10m
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release
on:
push:
tags:
- "v*.*.*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: "1.18"
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Run GoReleaser
uses: goreleaser/[email protected]
with:
distribution: goreleaser
version: latest
args: --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER_TOKEN }}
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Test
on: [push, pull_request, workflow_dispatch]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: "1.18"
- name: run tests
run: make test
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@

# Dependency directories (remove the comment below to include it)
# vendor/

dist/
coverage/
config.yaml
.vscode
.air.toml
.idea/
tmp/

expt/
requests.http
147 changes: 147 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
run:
go: '1.17'
timeout: 10m
skip-files:
- expt/main.go

output:
format: colored-line-number

linters:
enable-all: true
disable:
- exhaustruct
- cyclop
- exhaustive
- exhaustivestruct
- exhaustruct
- funlen
- gochecknoglobals
- gocyclo
- godox
- gofumpt
- golint
- interfacer
- lll
- maintidx
- ireturn
- maligned
- nlreturn
- nolintlint
- prealloc
- promlinter
- scopelint
- tagliatelle
- testpackage
- paralleltest
- tparallel
- containedctx
- varnamelen
- wrapcheck
- wsl

linters-settings:
decorder:
dec-order:
- type
- const
- var
- func
disable-dec-order-check: false
disable-init-func-first-check: false
dupl:
threshold: 100
errcheck: # Report about not checking of errors in type assertions: `a := b.(MyStruct)`.
check-type-assertions: true
goconst:
min-len: 2 # Minimal length of string constant.
min-occurrences: 2 # Minimum occurrences of constant string count to trigger issue.
ignore-tests: true
match-constant: false # Look for existing constants matching the values.
numbers: true # Search also for duplicated numbers.
min: 2 # Minimum value, only works with goconst.numbers
max: 2 # Maximum value, only works with goconst.numbers
revive:
ignore-generated-header: true
severity: warning
confidence: 0.8
rules:
- name: atomic
- name: context-as-argument
- name: context-keys-type
- name: defer
- name: dot-imports
- name: empty-block
- name: error-naming
- name: error-return
- name: error-strings
- name: errorf
- name: increment-decrement
- name: modifies-parameter
- name: modifies-value-receiver
- name: package-comments
- name: range
- name: receiver-naming
- name: redefines-builtin-id
- name: superfluous-else
- name: time-naming
- name: unreachable-code
- name: unused-parameter
- name: unused-receiver
- name: var-declaration
- name: var-naming
gomnd:
ignored-numbers:
- '0o600'
- '0o644'
- '0o655'
- '0o666'
- '0o770'
- '0o755'
- '0o765'
- '0o777'
ignored-functions:
- 'args.Error'
- 'strconv.ParseInt'
gosimple:
go: "1.17"
checks:
- "all"
staticcheck:
go: "1.17"
checks:
- "all"
goimports:
local-prefixes: github.com/odpf/dex
gci:
sections:
- standard # Captures all standard packages if they do not match another section.
- default # Contains all imports that could not be matched to another section type.
- prefix(github.com/odpf/dex) # Groups all imports with the specified Prefix.
gocritic:
disabled-checks:
- ifElseChain
- singleCaseSwitch
enabled-tags:
- diagnostic
# - style
# - opinionated
# - performance
unparam:
# Inspect exported functions.
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
check-exported: true

issues:
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test\.go
linters:
- gocritic
- dupl
- path: cli
linters:
- forbidigo
- contextcheck
severity:
default-severity: error
80 changes: 80 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
project_name: dex

release:
prerelease: auto
draft: true

builds:
- main: ./main.go
id: "dex"
binary: dex
flags: [ -a ]
ldflags:
- -X github.com/odpf/dex/pkg/version.Version={{.Tag}}
- -X github.com/odpf/dex/pkg/version.Commit={{.FullCommit}}
- -X github.com/odpf/dex/pkg/version.BuildTime={{.Date}}
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0

archives:
- replacements:
darwin: macos
linux: linux
windows: windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Version }}-next"

changelog:
sort: asc
filters:
exclude:
- '^docs'
- '^test'
- '^build'
- '^ci'
- '^chore'
- '^refactor'

dockers:
- goos: linux
goarch: amd64
ids:
- dex
dockerfile: Dockerfile
image_templates:
- 'docker.io/odpf/{{.ProjectName}}:latest'
- 'docker.io/odpf/{{.ProjectName}}:{{ .Version }}'
- 'docker.io/odpf/{{.ProjectName}}:{{ .Version }}-amd64'

brews:
- name: dex
homepage: "https://github.com/odpf/dex"
description: "Infrastructure orchestration tool."
tap:
owner: odpf
name: homebrew-tap
license: "Apache 2.0"
folder: Formula
dependencies:
- name: git
install: |-
bin.install "dex"
commit_author:
name: Shivaprasad Bhat
email: [email protected]
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM alpine:3.13

COPY dex /usr/bin/dex

RUN apk --no-cache add ca-certificates bash
RUN GRPC_HEALTH_PROBE_VERSION=v0.4.5 && \
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \
chmod +x /bin/grpc_health_probe

CMD ["dex"]
Loading

0 comments on commit 5441dec

Please sign in to comment.