Skip to content

Commit 597eb79

Browse files
authored
Merge pull request #14 from conjurinc/reset-master
Reset project with golang based preflight CLI
2 parents 451c937 + da2d062 commit 597eb79

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1642
-297
lines changed

.codeclimate.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
---
2+
# This is our default .CodeClimate.yml, broken out by language. Uncomment the
3+
# sections at the bottom that apply to your project. ACTION comments indicate
4+
# places where config might need to be tweaked.
5+
6+
version: "2"
7+
8+
checks:
9+
# ----------------
10+
# These maintainability checks are language independent and check against all
11+
# languages
12+
13+
method-lines:
14+
config:
15+
threshold: 70
16+
return-statements:
17+
config:
18+
threshold: 7
19+
20+
plugins:
21+
# ---------------
22+
# Cross-language plugins. Should always be on.
23+
24+
duplication: # Looks for similar and identical code blocks
25+
enabled: true
26+
config:
27+
languages:
28+
go:
29+
java:
30+
javascript:
31+
php:
32+
python:
33+
python_version: 3 # ACTION Comment this out if using Python 2
34+
ruby:
35+
swift:
36+
typescript:
37+
checks:
38+
Similar code:
39+
# Kept triggering on package names in Golang so I'm disabling
40+
enabled: false
41+
42+
fixme: # Flags any FIXME, TODO, BUG, XXX, HACK comments so they can be fixed
43+
enabled: true
44+
config:
45+
strings:
46+
- FIXME
47+
- TODO
48+
- HACK
49+
- XXX
50+
- BUG
51+
exclude_patterns:
52+
# Exclude `context.T O D O()` false positives
53+
- "internal/configurationmanagers/kubernetes/"
54+
- "internal/providers/kubernetessecrets/"
55+
- "test/providers/kubernetessecrets/"
56+
57+
# ---------------
58+
# Commonly-used languages - run time is minimal and all of these will work
59+
# whether files of that language are found or not. In general, leave
60+
# uncommented
61+
62+
# Markdown
63+
markdownlint:
64+
enabled: true
65+
# ... CONFIG CONTENT ...
66+
checks:
67+
MD034:
68+
enabled: false
69+
70+
# Go
71+
gofmt:
72+
enabled: true
73+
golint:
74+
enabled: true
75+
exclude_patterns:
76+
- "**/" # exclude all
77+
- "!./cmd/" # unexclude just the ones we want to lint
78+
- "!./internal/"
79+
- "!./pkg/"
80+
- "!./test/"
81+
govet:
82+
enabled: true
83+
84+
# Ruby
85+
flog:
86+
enabled: true
87+
reek:
88+
enabled: true
89+
rubocop:
90+
enabled: true
91+
channel:
92+
rubocop-0-79 # As of March 10, 2020, rubocop 0.80.1 is the latest
93+
# However, it does not work with CodeClimate - throws
94+
# an Invalid JSON error.
95+
# ACTION uncomment bundler-audit below if using Gemfile/Gemfile.lock
96+
# ACTION uncomment brakeman below if using Rails
97+
98+
# Shell scripts
99+
shellcheck:
100+
enabled: true
101+
checks:
102+
# Disable 'Not following' check - it doesn't handle ". ./script.sh"
103+
# properly
104+
SC1091:
105+
enabled: false
106+
SC2148:
107+
enabled: false
108+
109+
# ---------------
110+
# Other languages - will work with or without language files present. Again,
111+
# runtime is minimal, so OK to leave uncommented.
112+
113+
# CoffeeScript
114+
coffeelint:
115+
enabled: true
116+
117+
# CSS
118+
csslint:
119+
enabled: true
120+
121+
# Groovy
122+
codenarc:
123+
enabled: true
124+
125+
# Java
126+
pmd:
127+
enabled: true
128+
sonar-java:
129+
enabled: true
130+
config:
131+
sonar.java.source: "7" # ACTION set this to the major version of Java used
132+
# ACTION uncomment checkstyle below if Java code exists in repo
133+
134+
# Node.js
135+
nodesecurity:
136+
enabled: true
137+
# ACTION uncomment eslint below if JavaScript already exists and .eslintrc
138+
# file exists in repo
139+
140+
# PHP
141+
phan:
142+
enabled: true
143+
config:
144+
file_extensions: "php"
145+
phpcodesniffer:
146+
enabled: true
147+
config:
148+
file_extensions: "php,inc,lib"
149+
# Using Wordpress standards as our one PHP repo is a Wordpress theme
150+
standards: "PSR1,PSR2,WordPress,WordPress-Core,WordPress-Extra"
151+
phpmd:
152+
enabled: true
153+
config:
154+
file_extensions: "php,inc,lib"
155+
rulesets: "cleancode,codesize,controversial,naming,unusedcode"
156+
sonar-php:
157+
enabled: true
158+
159+
# Python
160+
bandit:
161+
enabled: true
162+
pep8:
163+
enabled: true
164+
radon:
165+
enabled: true
166+
# config:
167+
# python_version: 2 # ACTION Uncomment these 2 lines if using Python 2
168+
sonar-python:
169+
enabled: true
170+
171+
# ---------------
172+
# Configuration Required Language specific - these will error and abort the
173+
# codeclimate run if they are turned on and certain files or configuration are
174+
# missing. Should be commented out unless the project already includes the
175+
# necessary files that the linter looks at
176+
177+
# Ruby - requires presence of Gemfile and Gemfile.lock
178+
# bundler-audit:
179+
# enabled: true
180+
181+
# Rails - requires detecting a Rails application
182+
# brakeman:
183+
# enabled: true
184+
185+
# Chef - requires detecting a cookbook
186+
# foodcritic:
187+
# enabled: true
188+
189+
# Java - might require Java code? Errored when run without
190+
# checkstyle:
191+
# enabled: true
192+
193+
# JavaScript - requires an eslintrc to be created and added to project
194+
# eslint:
195+
# enabled: true
196+
# channel: "eslint-6"
197+
198+
# ---------------
199+
# List any files/folders to exclude from checking. Wildcards accepted. Leave
200+
# commented if no files to exclude as an empty array will error
201+
exclude_patterns:
202+
- ".gitignore"
203+
- "dev/conjur-hacks/*.rb"
204+
# Exclude autogenerated code
205+
- "pkg/k8sclient/"

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
c.out
2+
internal/cmd/mocks/
3+
Jenkinsfile
4+
5+
dev/
6+
dist/
7+
output/
8+
9+
**/*.sw[po]

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* @cyberark/core-team @conjurinc/core-team @conjurdemos/core-team
2+
3+
# Changes to .trivyignore require Security Architect approval
4+
.trivyignore @cyberark/security-architects @conjurinc/security-architects @conjurdemos/security-architects
5+
6+
# Changes to .codeclimate.yml require Quality Architect approval
7+
.codeclimate.yml @cyberark/quality-architects @conjurinc/quality-architects @conjurdemos/quality-architects
8+
9+
# Changes to SECURITY.md require Security Architect approval
10+
SECURITY.md @cyberark/security-architects @conjurinc/security-architects @conjurdemos/security-architects

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
3+
name: goreleaser
4+
5+
on:
6+
# Run this on pushes to any branch
7+
push:
8+
9+
jobs:
10+
goreleaser:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
- name: Set up Go
16+
uses: actions/setup-go@v3
17+
with:
18+
go-version: '1.19'
19+
- name: Install GoReleaser
20+
uses: goreleaser/goreleaser-action@v3
21+
with:
22+
install-only: true
23+
- name: Run GoReleaser
24+
run: GORELEASER_CURRENT_TAG=v0.0.0 goreleaser release --snapshot --rm-dist
25+
- name: Upload assets
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: binaries
29+
path: dist/binaries/*

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
action/mocks/*.go
2+
c.out
3+
junit.xml
4+
junit.output
5+
key.txt
6+
coverage.xml
7+
8+
output/
9+
dist/
10+
dev/tmp
11+
build_ca_certificate
12+
13+
# CLI binaries
14+
conjur-preflight
15+
# Exclude binary entrypoint
16+
!cmd/conjur-preflight

.goreleaser.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
project_name: conjur-preflight
3+
4+
before:
5+
hooks:
6+
# You may remove this if you don't use go modules.
7+
- go mod tidy
8+
# you may remove this if you don't need go generate
9+
- go generate ./...
10+
builds:
11+
- main: ./cmd/conjur-preflight
12+
binary: conjur-preflight
13+
env:
14+
- CGO_ENABLED=0
15+
# Tag 'netgo' is a Go build tag that ensures a pure Go networking stack
16+
# in the resulting binary instead of using the default host's stack to
17+
# ensure a fully static artifact that has no dependencies.
18+
flags:
19+
- -tags=netgo
20+
- -a
21+
goos:
22+
- linux
23+
goamd64:
24+
- v1
25+
# The `Tag` override is there to provide the git commit information in the
26+
# final binary. See `Static long version tags` in the `Building` section
27+
# of `CONTRIBUTING.md` for more information.
28+
ldflags:
29+
- -w
30+
- -X "github.com/cyberark/conjur-preflight/pkg/version.Tag={{ .ShortCommit }}"
31+
hooks:
32+
post:
33+
# Copy the binary out into the <dist> path, and give the copy the name we
34+
# want in the release <extra_files>.
35+
- mkdir -p "{{ dir .Path }}/../binaries"
36+
- cp "{{ .Path }}" "{{ dir .Path }}/../binaries/conjur-preflight{{ .Target }}{{ .Ext }}"
37+
38+
archives:
39+
- id: conjur-preflight-archive
40+
files:
41+
- CHANGELOG.md
42+
- LICENSE
43+
- README.md
44+
name_template: "{{.ProjectName}}_{{.Version}}_{{.Os}}_{{.Arch}}"
45+
wrap_in_directory: true
46+
47+
checksum:
48+
name_template: "SHA256SUMS.txt"
49+
50+
nfpms:
51+
- bindir: /usr/bin
52+
description: CyberArk Conjur Enteprise Preflight Qualification Tool
53+
file_name_template: "{{.ProjectName}}_{{.Version}}_{{.Arch}}"
54+
formats:
55+
- deb
56+
- rpm
57+
homepage: https://conjur.org
58+
license: "Apache 2.0"
59+
maintainer: CyberArk Maintainers <conj_maintainers@cyberark.com>
60+
vendor: CyberArk
61+
62+
snapshot:
63+
name_template: "{{ .Tag }}-next"
64+
65+
release:
66+
disable: true
67+
draft: true
68+
extra_files:
69+
- glob: CHANGELOG.md
70+
- glob: LICENSE
71+
- glob: README.md
72+
- glob: dist/binaries

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
### Changed
9+
- Nothing should go in this section, please add to the latest unreleased version
10+
(and update the corresponding date), or add a new version.
11+
12+
## [0.1.0] - 2022-12-09
13+
14+
[Unreleased]: https://github.com/cyberark/conjur/compare/v0.0.0...HEAD

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing
2+
3+
For general contribution and community guidelines, please see the [community repo](https://github.com/cyberark/community).
4+
5+
1. [Fork the project](https://help.github.com/en/github/getting-started-with-github/fork-a-repo)
6+
1. [Clone your fork](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository)
7+
1. Make local changes to your fork by editing files
8+
1. [Commit your changes](https://help.github.com/en/github/managing-files-in-a-repository/adding-a-file-to-a-repository-using-the-command-line)
9+
1. [Push your local changes to the remote server](https://help.github.com/en/github/using-git/pushing-commits-to-a-remote-repository)
10+
1. [Create new Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork)
11+
12+
From here your pull request will be reviewed and once you've responded to all
13+
feedback it will be merged into the project. Congratulations, you're a
14+
contributor!
15+
16+
## Releasing
17+
18+
To create a new release, follow the instructions in our general release
19+
guidelines [here](https://github.com/cyberark/community/blob/master/Conjur/CONTRIBUTING.md#release-process).

0 commit comments

Comments
 (0)