Skip to content

Commit aecf02b

Browse files
authored
Merge 6f0d884 into 982fc94
2 parents 982fc94 + 6f0d884 commit aecf02b

31 files changed

+2449
-1
lines changed

.github/config/environments.tf

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module "keyfactor_github_test_environment_ad_10_5_0" {
2+
source = "git::ssh://[email protected]/Keyfactor/terraform-module-keyfactor-github-test-environment-ad.git?ref=main"
3+
4+
gh_environment_name = "KFC_10_5_0"
5+
gh_repo_name = data.github_repository.repo.name
6+
keyfactor_hostname = var.keyfactor_hostname_10_5_0
7+
keyfactor_username = var.keyfactor_username_10_5_0
8+
keyfactor_password = var.keyfactor_password_10_5_0
9+
}
10+
11+
# module "keyfactor_github_test_environment_11_5_0_kc" {
12+
# source = "git::ssh://[email protected]/Keyfactor/terraform-module-keyfactor-github-test-environment-kc.git?ref=main"
13+
#
14+
# gh_environment_name = "KFC_11_5_0_KC"
15+
# gh_repo_name = data.github_repository.repo.name
16+
# keyfactor_hostname = var.keyfactor_hostname_11_5_0_KC
17+
# keyfactor_client_id = var.keyfactor_client_id_11_5_0
18+
# keyfactor_client_secret = var.keyfactor_client_secret_11_5_0
19+
# keyfactor_auth_hostname = var.keyfactor_auth_hostname_11_5_0_KC
20+
# keyfactor_tls_skip_verify = true
21+
# }
22+
23+
module "keyfactor_github_test_environment_12_3_0_kc" {
24+
source = "git::ssh://[email protected]/Keyfactor/terraform-module-keyfactor-github-test-environment-ad.git?ref=main"
25+
26+
gh_environment_name = "KFC_12_3_0_KC"
27+
gh_repo_name = data.github_repository.repo.name
28+
keyfactor_hostname = var.keyfactor_hostname_12_3_0_KC
29+
keyfactor_auth_token_url = var.keyfactor_auth_token_url_12_3_0_KC
30+
keyfactor_client_id = var.keyfactor_client_id_12_3_0
31+
keyfactor_client_secret = var.keyfactor_client_secret_12_3_0
32+
keyfactor_tls_skip_verify = true
33+
}

.github/config/providers.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
required_providers {
4+
github = {
5+
source = "integrations/github"
6+
version = ">=6.2"
7+
}
8+
}
9+
backend "azurerm" {
10+
resource_group_name = "integrations-infra"
11+
storage_account_name = "integrationstfstate"
12+
container_name = "tfstate"
13+
key = "github/repos/keyfactor-auth-client-go.tfstate"
14+
}
15+
}
16+
17+
provider "github" {
18+
# Configuration options
19+
owner = "Keyfactor"
20+
}

.github/config/repo.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
data "github_repository" "repo" {
2+
name = "keyfactor-auth-client-go"
3+
}

.github/config/variables.tf

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
variable "keyfactor_hostname_10_5_0" {
2+
description = "The hostname of the Keyfactor instance"
3+
type = string
4+
default = "integrations1050-lab.kfdelivery.com"
5+
}
6+
7+
variable "keyfactor_username_10_5_0" {
8+
description = "The username to authenticate with the Keyfactor instance"
9+
type = string
10+
}
11+
12+
variable "keyfactor_password_10_5_0" {
13+
description = "The password to authenticate with the Keyfactor instance"
14+
type = string
15+
}
16+
17+
variable "keyfactor_client_id_12_3_0" {
18+
description = "The client ID to authenticate with the Keyfactor instance using Keycloak client credentials"
19+
type = string
20+
}
21+
22+
variable "keyfactor_client_secret_12_3_0" {
23+
description = "The client secret to authenticate with the Keyfactor instance using Keycloak client credentials"
24+
type = string
25+
}
26+
27+
variable "keyfactor_hostname_12_3_0_KC" {
28+
description = "The hostname of the Keyfactor instance"
29+
type = string
30+
default = "int-oidc-lab.eastus2.cloudapp.azure.com"
31+
}
32+
33+
variable "keyfactor_auth_token_url_12_3_0_KC" {
34+
description = "The hostname of the KeyCloak instance to authenticate to for a Keyfactor Command access token"
35+
type = string
36+
default = "https://int-oidc-lab.eastus2.cloudapp.azure.com:8444/realms/Keyfactor/protocol/openid-connect/token"
37+
}
38+

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See GitHub's documentation for more information on this file:
2+
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"
9+
- package-ecosystem: "gomod"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"

.github/workflows/go_tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Go Test Workflow
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
7+
jobs:
8+
test:
9+
name: Run tests
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
environment: [ "KFC_10_5_0", "KFC_12_3_0_KC"]
14+
environment: ${{ matrix.environment }}
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v3
21+
with:
22+
go-version: 1.22
23+
24+
- name: Run tests
25+
run: go test -v -cover ./auth_providers/...
26+
env:
27+
KEYFACTOR_PASSWORD: ${{ secrets.KEYFACTOR_PASSWORD }}
28+
KEYFACTOR_USERNAME: ${{ secrets.KEYFACTOR_USERNAME }}
29+
KEYFACTOR_AUTH_CLIENT_ID: ${{ secrets.KEYFACTOR_AUTH_CLIENT_ID }}
30+
KEYFACTOR_AUTH_CLIENT_SECRET: ${{ secrets.KEYFACTOR_AUTH_CLIENT_SECRET }}
31+
KEYFACTOR_HOSTNAME: ${{ vars.KEYFACTOR_HOSTNAME }}
32+
KEYFACTOR_AUTH_HOSTNAME: ${{ vars.KEYFACTOR_AUTH_HOSTNAME }}
33+
KEYFACTOR_SKIP_VERIFY: ${{ vars.KEYFACTOR_SKIP_VERIFY }}
34+
TEST_KEYFACTOR_AD_AUTH: ${{ vars.TEST_KEYFACTOR_AD_AUTH }}
35+
TEST_KEYFACTOR_KC_AUTH: ${{ vars.TEST_KEYFACTOR_KC_AUTH }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Keyfactor Bootstrap Workflow
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [ opened, closed, synchronize, edited, reopened ]
7+
push:
8+
create:
9+
branches:
10+
- 'release-*.*'
11+
12+
jobs:
13+
call-starter-workflow:
14+
uses: keyfactor/actions/.github/workflows/starter.yml@v3
15+
secrets:
16+
token: ${{ secrets.V2BUILDTOKEN}}
17+
APPROVE_README_PUSH: ${{ secrets.APPROVE_README_PUSH}}
18+
gpg_key: ${{ secrets.KF_GPG_PRIVATE_KEY }}
19+
gpg_pass: ${{ secrets.KF_GPG_PASSPHRASE }}

.gitignore

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
### JetBrains template
2+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
3+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
4+
5+
# User-specific stuff
6+
.idea/**/workspace.xml
7+
.idea/**/tasks.xml
8+
.idea/**/usage.statistics.xml
9+
.idea/**/dictionaries
10+
.idea/**/shelf
11+
12+
# AWS User-specific
13+
.idea/**/aws.xml
14+
15+
# Generated files
16+
.idea/**/contentModel.xml
17+
18+
# Sensitive or high-churn files
19+
.idea/**/dataSources/
20+
.idea/**/dataSources.ids
21+
.idea/**/dataSources.local.xml
22+
.idea/**/sqlDataSources.xml
23+
.idea/**/dynamic.xml
24+
.idea/**/uiDesigner.xml
25+
.idea/**/dbnavigator.xml
26+
27+
# Gradle
28+
.idea/**/gradle.xml
29+
.idea/**/libraries
30+
31+
# Gradle and Maven with auto-import
32+
# When using Gradle or Maven with auto-import, you should exclude module files,
33+
# since they will be recreated, and may cause churn. Uncomment if using
34+
# auto-import.
35+
# .idea/artifacts
36+
# .idea/compiler.xml
37+
# .idea/jarRepositories.xml
38+
# .idea/modules.xml
39+
# .idea/*.iml
40+
# .idea/modules
41+
# *.iml
42+
# *.ipr
43+
44+
# CMake
45+
cmake-build-*/
46+
47+
# Mongo Explorer plugin
48+
.idea/**/mongoSettings.xml
49+
50+
# File-based project format
51+
*.iws
52+
53+
# IntelliJ
54+
out/
55+
56+
# mpeltonen/sbt-idea plugin
57+
.idea_modules/
58+
59+
# JIRA plugin
60+
atlassian-ide-plugin.xml
61+
62+
# Cursive Clojure plugin
63+
.idea/replstate.xml
64+
65+
# SonarLint plugin
66+
.idea/sonarlint/
67+
68+
# Crashlytics plugin (for Android Studio and IntelliJ)
69+
com_crashlytics_export_strings.xml
70+
crashlytics.properties
71+
crashlytics-build.properties
72+
fabric.properties
73+
74+
# Editor-based Rest Client
75+
.idea/httpRequests
76+
77+
# Android studio 3.1+ serialized cache file
78+
.idea/caches/build_file_checksums.ser
79+
80+
### Terraform template
81+
# Local .terraform directories
82+
**/.terraform/*
83+
84+
# .tfstate files
85+
*.tfstate
86+
*.tfstate.*
87+
88+
# Crash log files
89+
crash.log
90+
crash.*.log
91+
92+
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
93+
# password, private keys, and other secrets. These should not be part of version
94+
# control as they are data points which are potentially sensitive and subject
95+
# to change depending on the environment.
96+
*.tfvars
97+
*.tfvars.json
98+
99+
# Ignore override files as they are usually used to override resources locally and so
100+
# are not checked in
101+
override.tf
102+
override.tf.json
103+
*_override.tf
104+
*_override.tf.json
105+
106+
# Include override files you do wish to add to version control using negated pattern
107+
# !example_override.tf
108+
109+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
110+
# example: *tfplan*
111+
112+
# Ignore CLI configuration files
113+
.terraformrc
114+
terraform.rc
115+
116+
### Go template
117+
# If you prefer the allow list template instead of the deny list, see community template:
118+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
119+
#
120+
# Binaries for programs and plugins
121+
*.exe
122+
*.exe~
123+
*.dll
124+
*.so
125+
*.dylib
126+
127+
# Test binary, built with `go test -c`
128+
*.test
129+
130+
# Output of the go coverage tool, specifically when used with LiteIDE
131+
*.out
132+
133+
# Dependency directories (remove the comment below to include it)
134+
# vendor/
135+
136+
# Go workspace file
137+
go.work
138+
139+
*.env*

Makefile

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
PROVIDER_DIR := $(PWD)
2+
TEST?=$$(go list ./... | grep -v 'vendor')
3+
HOSTNAME=keyfactor.com
4+
GOFMT_FILES := $$(find $(PROVIDER_DIR) -name '*.go' |grep -v vendor)
5+
NAMESPACE=keyfactor
6+
WEBSITE_REPO=https://github.com/Keyfactor/keyfactor-auth-client
7+
NAME=keyfactor-auth-client
8+
BINARY=${NAME}
9+
VERSION := $(GITHUB_REF_NAME)
10+
ifeq ($(VERSION),)
11+
VERSION := v1.0.0
12+
endif
13+
OS_ARCH := $(shell go env GOOS)_$(shell go env GOARCH)
14+
BASEDIR := ${HOME}/go/bin
15+
INSTALLDIR := ${BASEDIR}
16+
MARKDOWN_FILE := README.md
17+
TEMP_TOC_FILE := temp_toc.md
18+
19+
20+
21+
default: build
22+
23+
build: fmt
24+
go install
25+
26+
release:
27+
GOOS=darwin GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_darwin_amd64 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
28+
GOOS=freebsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_freebsd_386 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
29+
GOOS=freebsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_freebsd_amd64 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$(git rev-parse HEAD)'"
30+
GOOS=freebsd GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_freebsd_arm -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
31+
GOOS=linux GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_linux_386 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
32+
GOOS=linux GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_linux_amd64 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
33+
GOOS=linux GOARCH=arm go build -o ./bin/${BINARY}_${VERSION}_linux_arm -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
34+
GOOS=openbsd GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_openbsd_386 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
35+
GOOS=openbsd GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_openbsd_amd64 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
36+
GOOS=solaris GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_solaris_amd64 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
37+
GOOS=windows GOARCH=386 go build -o ./bin/${BINARY}_${VERSION}_windows_386 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
38+
GOOS=windows GOARCH=amd64 go build -o ./bin/${BINARY}_${VERSION}_windows_amd64 -ldflags "-X 'keyfactor_auth_client/pkg.Version=${VERSION}' -X 'keyfactor_auth_client/pkg.BuildTime=$$(date)' -X 'keyfactor_auth_client/pkg.CommitHash=$$(git rev-parse HEAD)'"
39+
40+
install: fmt
41+
go build -o ${BINARY}
42+
rm -rf ${INSTALLDIR}/${BINARY}
43+
mkdir -p ${INSTALLDIR}
44+
chmod oug+x ${BINARY}
45+
cp ${BINARY} ${INSTALLDIR}
46+
mkdir -p ${HOME}/.local/bin || true
47+
mv ${BINARY} ${HOME}/.local/bin/${BINARY}
48+
49+
vendor:
50+
go mod vendor
51+
52+
version:
53+
@echo ${VERSION}
54+
55+
setversion:
56+
sed -i '' -e 's/VERSION = ".*"/VERSION = "$(VERSION)"/' pkg/version/version.go
57+
58+
test:
59+
go test -i $(TEST) || exit 1
60+
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
61+
62+
fmt:
63+
gofmt -w $(GOFMT_FILES)
64+
65+
prerelease: fmt setversion
66+
git tag -d $(VERSION) || true
67+
git push origin :$(VERSION) || true
68+
git tag $(VERSION)
69+
git push origin $(VERSION)
70+
71+
check_toc:
72+
@grep -q 'TOC_START' $(MARKDOWN_FILE) && echo "TOC already exists." || (echo "TOC not found. Generating..." && $(MAKE) generate_toc)
73+
74+
generate_toc:
75+
# check if markdown-toc is installed and if not install it
76+
@command -v markdown-toc >/dev/null 2>&1 || (echo "markdown-toc is not installed. Installing..." && npm install -g markdown-toc)
77+
markdown-toc -i $(MARKDOWN_FILE) --skip 'Table of Contents'
78+
79+
80+
.PHONY: build prerelease release install test fmt vendor version setversion

0 commit comments

Comments
 (0)