Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ab#55000 #204

Draft
wants to merge 11 commits into
base: epic-55000
Choose a base branch
from
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
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 and Logs**

If applicable, add screenshots and logs to help explain your problem.

**Product Deployment**

Please complete the following information:
- Deployment format: [e.g. software, container]
- Version [e.g. 8.0.0]

**Desktop**

Please complete the following information:
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Additional Context**

Add any other context about the problem here.
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
blank_issues_enabled: true

contact_links:
- name: GitHub Discussions
url: https://github.com/Keyfactor/kfutil/discussions
about: Join in-depth discussions or ask questions
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem or specific use case? Please describe.**
A clear and concise description of the problem or use case.

**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.

**Product deployment**
Please complete the following information:
- Deployment format: [e.g. software, container]
- Version [e.g. 8.0.0]

**Additional context**
Add any other context or screenshots about the feature request here.
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Describe your changes

<!--- Please describe your changes in detail. Include the motivation for the changes, e.g. what problem it solves or if it fixes a bug. -->

## How has this been tested?

<!--- If relevant, please describe any tests you ran to verify your changes. -->

## Checklist before requesting a review
<!--- To check or uncheck a box, switch between "[x]" and "[ ]" below. -->

- [ ] I have performed a self-review of my code
- [ ] I have kept the patch limited to only change the parts related to the patch
- [ ] This change requires a documentation update

33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Go Lint
on: [workflow_dispatch, push, pull_request]
jobs:
build:
name: Build and Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@v4

# Setup GoLang build environment
# https://github.com/actions/setup-go
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
cache: true

# Download dependencies
- run: go mod download

# Build Go binary
- run: go build -v .

# Run Go linters
# https://github.com/golangci/golangci-lint-action
- name: Run linters
uses: golangci/golangci-lint-action@v6
with:
version: latest
95 changes: 95 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,37 @@ jobs:
- name: Run tests
run: echo "Running tests for KF 11.x.x"

## KFC 12.x.x
kf_12_x_x:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: echo "Running tests for KF 12.x.x"

### Store Type Tests
Test_StoreTypes_KFC_12_0_0:
runs-on: ubuntu-latest
needs:
- build
- kf_11_x_x
env:
SECRET_NAME: "command-config-1200-clean"
KEYFACTOR_HOSTNAME: "int1200-test-clean.kfdelivery.com"
KEYFACTOR_DOMAIN: "command"
KEYFACTOR_USERNAME: ${{ secrets.LAB_USERNAME }}
KEYFACTOR_PASSWORD: ${{ secrets.LAB_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: |
unset KFUTIL_DEBUG
go test -v ./cmd -run "^Test_StoreTypes*"

Test_StoreTypes_KFC_11_2_0:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -182,6 +212,23 @@ jobs:


### Store Tests
Test_Stores_KFC_12_0_0:
runs-on: ubuntu-latest
needs:
- build
- kf_12_x_x
- Test_StoreTypes_KFC_12_0_0
env:
SECRET_NAME: "command-config-1200"
KEYFACTOR_HOSTNAME: "integrations1200-lab.kfdelivery.com"
KEYFACTOR_DOMAIN: "command"
KEYFACTOR_USERNAME: ${{ secrets.LAB_USERNAME }}
KEYFACTOR_PASSWORD: ${{ secrets.LAB_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: go test -v ./cmd -run "^Test_Stores_*"
Test_Stores_KFC_11_2_0:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -218,6 +265,27 @@ jobs:
run: go test -v ./cmd -run "^Test_Stores_*"

### PAM Tests
Test_PAM_KFC_12_0_0:
runs-on: ubuntu-latest
needs:
- build
- kf_12_x_x
- Test_StoreTypes_KFC_12_0_0
env:
SECRET_NAME: "command-config-1200"
KEYFACTOR_HOSTNAME: "integrations1200-lab.kfdelivery.com"
KEYFACTOR_DOMAIN: "command"
KEYFACTOR_USERNAME: ${{ secrets.LAB_USERNAME }}
KEYFACTOR_PASSWORD: ${{ secrets.LAB_PASSWORD }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run tests
run: |
unset KFUTIL_DEBUG
go test -v ./cmd -run "^Test_PAM*"


Test_PAM_KFC_11_2_0:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -261,6 +329,33 @@ jobs:


### PAM Tests AKV Auth Provider
Test_AKV_PAM_KFC_12_0_0:
runs-on: self-hosted
needs:
- Test_PAM_KFC_12_0_0
env:
SECRET_NAME: "command-config-1200-az"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Install dependencies
run: go mod download && go mod tidy
- name: Get secret from Azure Key Vault
run: |
. ./examples/auth/akv/akv_auth.sh
cat $HOME/.keyfactor/command_config.json
- name: Install kfutil
run: |
make install
- name: Run tests
run: |
go test -v ./cmd -run "^Test_PAM*"


Test_AKV_PAM_KFC_11_2_0:
runs-on: self-hosted
needs:
Expand Down
2 changes: 1 addition & 1 deletion cmd/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

// Authenticate
//authConfig := createAuthConfigFromParams(kfcHostName, kfcUsername, kfcPassword, kfcDomain, kfcAPIPath)
//kfClient, _ := initClient(configFile, profile, providerType, providerProfile, noPrompt, authConfig, false)
//Client, _ := initClient(configFile, profile, providerType, providerProfile, noPrompt, authConfig, false)

// CLI Logic
return fmt.Errorf("delete store containers not implemented")
Expand Down Expand Up @@ -170,7 +170,7 @@
// GET containers command
containersCmd.AddCommand(containersGetCmd)
containersGetCmd.Flags().StringP("id", "i", "", "ID or name of the cert store container.")
containersGetCmd.MarkFlagRequired("id")

Check failure on line 173 in cmd/containers.go

View workflow job for this annotation

GitHub Actions / Build and Lint

Error return value of `containersGetCmd.MarkFlagRequired` is not checked (errcheck)

Check failure on line 173 in cmd/containers.go

View workflow job for this annotation

GitHub Actions / Build and Lint

Error return value of `containersGetCmd.MarkFlagRequired` is not checked (errcheck)
// CREATE containers command
//containersCmd.AddCommand(containersCreateCmd)
// UPDATE containers command
Expand Down
2 changes: 1 addition & 1 deletion cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
authConfig := createAuthConfigFromParams(kfcHostName, kfcUsername, kfcPassword, kfcDomain, kfcAPIPath)

if authConfig == nil {
log.Error().Msg("auth config is nil, invalid client configuration")
log.Error().Msg("auth config is nil, invalid Client configuration")
return fmt.Errorf(FailedAuthMsg)
}

Expand Down Expand Up @@ -234,7 +234,7 @@
}
}
log.Debug().Msgf("%s: exportToJSON", DebugFuncCall)
exportToJSON(out, exportPath)

Check failure on line 237 in cmd/export.go

View workflow job for this annotation

GitHub Actions / Build and Lint

Error return value is not checked (errcheck)

Check failure on line 237 in cmd/export.go

View workflow job for this annotation

GitHub Actions / Build and Lint

Error return value is not checked (errcheck)

log.Debug().Msgf("%s: exportCmd", DebugFuncExit)
log.Info().Msg("Export complete")
Expand Down Expand Up @@ -570,7 +570,7 @@
RootCmd.AddCommand(exportCmd)

exportCmd.Flags().StringVarP(&exportPath, "file", "f", "", "path to JSON output file with exported data")
exportCmd.MarkFlagRequired("file")

Check failure on line 573 in cmd/export.go

View workflow job for this annotation

GitHub Actions / Build and Lint

Error return value of `exportCmd.MarkFlagRequired` is not checked (errcheck)

Check failure on line 573 in cmd/export.go

View workflow job for this annotation

GitHub Actions / Build and Lint

Error return value of `exportCmd.MarkFlagRequired` is not checked (errcheck)

exportCmd.Flags().BoolVarP(&fAll, "all", "a", false, "export all exportable data to JSON file")
exportCmd.Flags().Lookup("all").NoOptDefVal = "true"
Expand Down
Loading
Loading