UNCLASSIFIED

Commit 2baaae9e authored by abrichards's avatar abrichards
Browse files

Dev 13 manifest

parent ea5daf0f
......@@ -50,17 +50,25 @@ vet: ## Run go vet against code.
go vet ./...
lint: ## Run go lint against code
golint -set_exit_status ./...
@golint -set_exit_status ./...
list: ## list makefile targets
@cat Makefile | grep -E '^\s*\S+\s*:'
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: # manifests generate ## Run tests.
test: ## manifests generate ## Run tests.
@go clean --cache
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.2/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out ; go tool cover -html=./cover.out -o ./coverage.html
integration: ## integration tests
@go clean --cache
@find ./integration-tests -type d | xargs -I {} bash -c "echo \"\"; echo \"Integration test dir: {}\"; go test -tags \"integration\" {}"
##@ Build
build: generate fmt vet lint ## Build manager binary.
build: generate fmt vet ## Build manager binary.
go build -o bin/manager main.go driver.go
run: manifests generate fmt vet ## Run a controller from your host.
......
## <img src="valkyrie.png" width="60"> Valkyrie Automated CICD Provisioning Tool
## Env Variables
- for local building and to closer simulate the pipeline set
- from root folder of project
- Note: GOMODCACHE seems to be only supported in go 1.16 +
- export GOMODCACHE=$(pwd)/.gomodcache
- example:
```
export GOMODCACHE=.gomodcache
go mod download -json
find .gomodcache | wc -l
docker build --progress plain -t abr .
```
### Golang Frameworks
- kubebuilder
- https://book.kubebuilder.io/introduction.html
......@@ -186,3 +173,16 @@ spec:
targetEnvironment: "il2"
```
4) Apply the resources created above to the k8s cluster
## Using gomodcache
- for local building and to closer simulate the pipeline set
- from root folder of project
- Note: GOMODCACHE seems to be only supported in go 1.16 +
- export GOMODCACHE=$(pwd)/.gomodcache
- example:
```
export GOMODCACHE=.gomodcache
go mod download -json
find .gomodcache | wc -l
docker build --progress plain -t abr .
```
package git
import (
"testing"
"github.com/go-git/go-billy/v5"
"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing/transport/http"
)
func TestRepoClientImpl_CheckoutOrCreateBranch(t *testing.T) {
type fields struct {
repo *git.Repository
fs *billy.Filesystem
auth *http.BasicAuth
}
type args struct {
branchName string
}
tests := []struct {
name string
fields fields
args args
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &RepoClientImpl{
repo: tt.fields.repo,
fs: tt.fields.fs,
auth: tt.fields.auth,
}
if err := c.CheckoutOrCreateBranch(tt.args.branchName); (err != nil) != tt.wantErr {
t.Errorf("RepoClientImpl.CheckoutOrCreateBranch() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}
......@@ -401,7 +401,7 @@ func updateTempFile(dnsFile billy.File, tempFile billy.File, log logr.Logger, ap
return
}
func writeToTempFile(scanner *bufio.Scanner, tempFile billy.File, log logr.Logger, appHostname string, targetEnvironment string ) (err error) {
func writeToTempFile(scanner *bufio.Scanner, tempFile billy.File, log logr.Logger, appHostname string, targetEnvironment string) (err error) {
var foundILSection bool
var inRecordSection bool
for scanner.Scan() {
......@@ -444,7 +444,6 @@ func writeToTempFile(scanner *bufio.Scanner, tempFile billy.File, log logr.Logge
return
}
func writeNewLine(tempFile billy.File, bytes []byte, log logr.Logger) (err error) {
_, err = tempFile.Write(bytes)
if err != nil {
......
......@@ -415,19 +415,19 @@ func (m *MockError) Error() string {
}
type MockGitlabClient struct {
newClientFunction func(token string, options ...gitlab.ClientOptionFunc) (*gitlab.Client, error)
getGroupsFunction func(name *string) ([]*gitlab.Group, int, error)
addGroupFunction func(options gitlab.CreateGroupOptions) (*gitlab.Group, int, error)
updateGroupFunction func(id int, options *gitlab.UpdateGroupOptions) (*gitlab.Group, int, error)
getGroupFunction func(groupID int) (*gitlab.Group, int, error)
expectedGroups map[int]*gitlab.Group
expectedProjects map[int]*gitlab.Project
getMRByIDFunc func(projectID int, mrID int) (*gitlab.MergeRequest, error)
closeMRFunc func(projectID int, mrID int) error
getMRsFunc func(projectID int, sourceBranch string, targetBranch string) ([]*gitlab.MergeRequest, error)
createMRFunc func(projectID int, mrOptions *gitlab.CreateMergeRequestOptions) (*gitlab.MergeRequest, error)
getProjectFunction func(projectID int) (*gitlab.Project, int, error)
addProjectFunction func(options gitlab.CreateProjectOptions) (*gitlab.Project, int, error)
newClientFunction func(token string, options ...gitlab.ClientOptionFunc) (*gitlab.Client, error)
getGroupsFunction func(name *string) ([]*gitlab.Group, int, error)
addGroupFunction func(options gitlab.CreateGroupOptions) (*gitlab.Group, int, error)
updateGroupFunction func(id int, options *gitlab.UpdateGroupOptions) (*gitlab.Group, int, error)
getGroupFunction func(groupID int) (*gitlab.Group, int, error)
expectedGroups map[int]*gitlab.Group
expectedProjects map[int]*gitlab.Project
getMRByIDFunc func(projectID int, mrID int) (*gitlab.MergeRequest, error)
closeMRFunc func(projectID int, mrID int) error
getMRsFunc func(projectID int, sourceBranch string, targetBranch string) ([]*gitlab.MergeRequest, error)
createMRFunc func(projectID int, mrOptions *gitlab.CreateMergeRequestOptions) (*gitlab.MergeRequest, error)
getProjectFunction func(projectID int) (*gitlab.Project, int, error)
addProjectFunction func(options gitlab.CreateProjectOptions) (*gitlab.Project, int, error)
updateProjectFunction func(projectID int, editProjectOptions gitlab.EditProjectOptions) (*gitlab.Project, int, error)
}
......
......@@ -22,9 +22,9 @@ func getGreenProject() gitlabv1alpha1.Project {
project := gitlabv1alpha1.Project{
TypeMeta: metav1.TypeMeta{},
ObjectMeta: metav1.ObjectMeta{
Name: GreenProjectName,
Namespace: GreenNamespace,
Annotations: make(map[string]string,0),
Name: GreenProjectName,
Namespace: GreenNamespace,
Annotations: make(map[string]string, 0),
},
Spec: gitlabv1alpha1.ProjectSpec{
Name: GreenProjectName,
......@@ -107,7 +107,7 @@ var _ = Describe("SetupWithManager", func() {
})
var _ = Describe("reconcile", func() {
Context("green state", func() {
Context("green state", func() {
sut, _, _, _ := getControllerWithMocksInGreenTestState()
request := getRequestWithDefaultNamespacedTestProject()
result, err := sut.Reconcile(context.TODO(), request)
......@@ -181,7 +181,7 @@ var _ = Describe("reconcile", func() {
Expect(log.loggedMessage).To(Equal(errorWhileLookingUpProject))
})
})
Context("getGitlabProject returns an error", func() {
Context("getGitlabProject returns an error", func() {
failingGitlabClient := MockGitlabClient{
getProjectFunction: func(groupID int) (*gitlab.Project, int, error) {
return nil, 500, &MockError{
......@@ -280,7 +280,7 @@ var _ = Describe("reconcile", func() {
Expect(status.updateFunctionCalled).To(BeTrue())
})
})
Context("updateProjectIDAnnotation returns an error", func() {
Context("updateProjectIDAnnotation returns an error", func() {
sut, _, log, _ := getControllerWithMocksInGreenTestState()
sut.Client.(*MockClient).UpdateFunction = func(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
......
package custom
import (
"io/ioutil"
"os"
"path/filepath"
// "strings"
"text/template"
)
// DirectoryScan -
func DirectoryScan(rootDir string, funcMap template.FuncMap) (*template.Template, error) {
cleanRoot := filepath.Clean(rootDir)
pfx := len(cleanRoot) + 1
root := template.New("")
err := filepath.Walk(cleanRoot, func(path string, info os.FileInfo, e1 error) error {
if !info.IsDir() {
if e1 != nil {
return e1
}
b, e2 := ioutil.ReadFile(path)
if e2 != nil {
return e2
}
name := path[pfx:]
t := root.New(name).Funcs(funcMap)
_, e2 = t.Parse(string(b))
if e2 != nil {
return e2
}
}
return nil
})
return root, err
}
// getType() t := fmt.Sprintf("%T", v)
package custom
import (
"reflect"
"testing"
"text/template"
)
func TestDirectoryScan(t *testing.T) {
type args struct {
rootDir string
funcMap template.FuncMap
}
tests := []struct {
name string
args args
want *template.Template
wantErr bool
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := DirectoryScan(tt.args.rootDir, tt.args.funcMap)
if (err != nil) != tt.wantErr {
t.Errorf("DirectoryScan() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("DirectoryScan() = %v, want %v", got, tt.want)
}
})
}
}
......@@ -14,6 +14,7 @@ require (
github.com/xanzy/go-gitlab v0.50.0
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/tools v0.1.4 // indirect
k8s.io/api v0.19.2
k8s.io/apimachinery v0.19.2
k8s.io/client-go v0.19.2
......
......@@ -436,6 +436,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
......@@ -502,6 +503,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
......@@ -529,6 +531,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
......@@ -544,6 +547,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
......@@ -578,10 +582,13 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79 h1:RX8C8PRZc2hTIod4ds8ij+/4RQX3AqhYj3uOHmyaz4E=
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
......@@ -628,6 +635,8 @@ golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200616133436-c1934b75d054/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.4 h1:cVngSRcfgyZCzys3KYOpCFa+4dqX/Oub9tAq00ttGVs=
golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
......
......@@ -2,7 +2,9 @@ package git
import (
"bufio"
"errors"
"fmt"
"os"
"strings"
"testing"
git2 "valkyrie.dso.mil/valkyrie-api/clients/git"
......@@ -10,9 +12,23 @@ import (
func TestGit(t *testing.T) {
username := "project_4548_bot"
token := "5uyJ8czyhyA6mf7vz6CG"
repository := "https://code.il2.dso.mil/platform-one/products/valkyrie/dso-dns.git"
username, ok := os.LookupEnv("GITLAB_INT_TEST_USERNAME")
if !ok {
fmt.Printf("%v", errors.New("env variable GITLAB_INT_TEST_USERNAME undefinded"))
return
}
token, ok := os.LookupEnv("GITLAB_INT_TEST_TOKEN")
if !ok {
fmt.Printf("%v", errors.New("env variable GITLAB_INT_TEST_TOKEN undefinded"))
return
}
repository, ok := os.LookupEnv("GITLAB_INT_TEST_REPOSITORY")
if !ok {
fmt.Printf("%v", errors.New("env variable GITLAB_INT_TEST_REPOSITORY undefinded"))
return
}
client, err := git2.NewClient(username, token, repository)
if err != nil {
......
......@@ -3,6 +3,8 @@
package api
import (
"os"
"errors"
gitlab2 "github.com/xanzy/go-gitlab"
"testing"
"valkyrie.dso.mil/valkyrie-api/clients/gitlab"
......
# Template Management
## Reference
[Cookiecuttters](https://cookiecutter.readthedocs.io/en/1.7.2/)
## Testing templates
- build
```
docker build --progress plain -t cc -f python39_cookiecutter.Dockerfile .
docker run cc -h
```
- run
```
docker run -v $(pwd):/workspace cc --no-input --output-dir output --verbose manifests/microservice/
```
## Adding a new cookiecutter template
1. Make sure you have a related [issue](https://repo1.dso.mil/platform-one/autobot/allspark/-/issues)
2. Check for the build tool in [pipelines](pipelines/) (ex. pipelines/npm). If it exists, skip to Step 2
- NOTE: the `project.yml` and `project-ci.yml` are derived from [These hello-pipeline](https://code.il2.dso.mil/platform-one/devops/pipeline-products/-/tree/master/products/platformone/hello-pipeline) samples.
- NOTE#2: given a file, line, directory with `{{ cookiecutter.VARIABLE }}`, when running the `VARIABLE` will be recognized and translated by the cookiecutter library.
1. ```
mkdir -p pipelines/BUILD_TOOL/{{cookiecutter.project_name}}
touch pipelines/BUILD_TOOL/{{cookiecutter.project_name}}/project-ci.yml
touch pipelines/BUILD_TOOL/{{cookiecutter.project_name}}/project.yml
touch pipelines/BUILD_TOOL/cookiecutter.json
```
1. Start simple and make your `project-ci.yml` look similar to `pipelines/npm/{{ cookiecutter.project_name }}/project-ci.yml`
2. Less simple... your `project.yml` > `pipelines/npm/{{ cookiecutter.project_name }}/project.yml`
3. Add defaults to `pipelines/BUILD_TOOL/cookiecutter.json` [Example](pipelines/npm/cookiecutter.json)
1. Check for the app template in [projects](projects/). If it exists, why are you here?!?!? Be happy and move on!
1. ```
mkdir -p project/PROJECT_NAME/create-PROJECT_NAME-app-THINGY/{{ cookiecutter.project_name }}
touch project/PROJECT_NAME/create-PROJECT_NAME-app-THINGY/cookiecutter.json
```
2. Add hello-world level code to `project/PROJECT_NAME/create-PROJECT_NAME-app-THINGY/{{ cookiecutter.project_name }}` directory. [Example](projects/react/create-react-app-js/{{ cookiecutter.project_name }})
1. We are considering `kpt` (because `git submodule` just isn't that great) to keep these templates in sync with [reality](https://code.il2.dso.mil/platform-one/devops/hello-pipeline)
3. Add defaults to `project/PROJECT_NAME/create-PROJECT_NAME-app-THINGY/cookiecutter.json` or maybe just copy-pasta `projects/react/create-react-app-js/cookiecutter.json`
{
"__content_path": "path_to_ctf",
"project_name": "",
"project_short_name": "None",
"team_name": "",
"language": "",
"version": "0.1.0",
"impact_level": "il2",
"environment": "development",
"__deployment_sites": [],
"categorization": {
"confidentiality": "Moderate",
"integrity": "Moderate",
"availability": "Moderate",
"classification_level": "UNCLASSIFIED",
"pii": "false"
},
"ext_type": "Default",
"__review_date": "<Get a schedule>",
"__assess_interval": "<Determine review periodicity>",
"__system_architecture": "<Create system diagram>",
"__status": "None",
"assets": {
"languages": [],
"data_type": [],
"storage_types": [],
"databases": [],
"external_systems": []
},
"__ctf_roles": {
"authorizing_official": {
"name": "",
"title": "",
"org": "",
"email": "",
"phone": ""
},
"system_owner": {
"name": "",
"title": "",
"org": "",
"email": "",
"phone": ""
},
"chief_information_security_officer": {
"name": "",
"title": "",
"org": "",
"email": "",
"phone": ""
},
"product_manager": {
"name": "",
"title": "",
"org": "",
"email": "",
"phone": ""
}
}
}
# Plan of Action for CAMP Sample Application
Please fill out the below information for your Certificate to Field (Ctf).
_Note: See the example **CAMP Sample Application** for additional details._
## _Test App, MVP and Beyond_
Note: The Test App consists of a subset of features that will comprise our MVP.
* **Kick-off Date:**
* **Inception Date:**
* **MVP Date:**
#### Vision
What is the desired goals of your application and its intended use?
#### Strategy
What considerations did you make when designing your aplication and how did you accomplish your goals?
#### Summary
### Goals and Metrics
<!-- What is your focus for this release -->
<!-- Put relevant metrics here -->
**Release Focus**
- Increase confidence in dev teams ability to onboard
<!-- What does this release or application do? -->
**Release Functionality**
- Provides developers with an application to get started
<!-- How could this application affect other applications within the system? -->
**System Integration Considerations**
- Integrates with the continuous ATO pipeline
- Reduces onboarding hassel for dev teams
---
# Full name of the system.
system-name: {{ cookiecutter.project_name }}
# Shortname or abbreviation.
short-name: {{ cookiecutter.project_short_name }}
# System version or release number.
version: {{ cookiecutter.version }}
# Operational Environments:
# - production
# - test
# - research and development
# - tactical
# - deployed
# - other
environments: {{ cookiecutter.environment }}
# Authorization Status: CtF
Status: {{ cookiecutter.__status }}
# Assessment Date. Identify date of last assessment per Continuous ATO (cATO).
Review-date: {{ cookiecutter.__review_date }}
# Security Re-Assess Interval. Period for re-assessment after updates
Assess-interval: {{ cookiecutter.__assess_interval }}
# Authorization boundary diagram. Include URL.
System-architecture: {{ cookiecutter.__system_architecture }}
# Confidentiality, Integrity, Availability: Low, Moderage, or High
# Classification: UNCLASSIFIED, SECRET//NOFORN, or TS/SCI
# Personally Identifiable Information: Y/N. Assessment team can help data types
Categorization:
Confidentiality: {{ cookiecutter.categorization.confidentiality }}
Integrity: {{ cookiecutter.categorization.integrity }}
Availability: {{ cookiecutter.categorization.availability }}
Classification-Level: {{ cookiecutter.categorization.classification_level }}
PII: {{ cookiecutter.categorization.pii }}
{% for asset, items in cookiecutter.assets.items() %}
{{ asset.capitalize() }}: {% if items == [] %}[]{% endif %}
{%- if items != [] %}
{%- for item in items %}
- {{ item }}
{%- endfor %}
{%- endif %}
{%- endfor %}
Role-Identification:
{%- for role, context in cookiecutter.__ctf_roles.items() %}
{{ role }}:
name: {{ context.name }}
title: {{ context.title }}
org: {{ context.org }}
email: {{ context.email }}
phone: {{ context.phone }}
{%- endfor %}
{
"project_name": "",
"impact_level": "il2"
}
# WELCOME TO YOUR NEW MANIFESTS
## Access
Your staging url is https://{{.project_name}}.staging.dso.mil
## What is this?
This project is the source of truth for your application in production. It is instantiated as a bare bones guess at what your app needs to deploy. It should serve to get your app 95% of the way there, with individual fixes needed for this specific app.
You should see a few folders
- base : The cluster agnostic k8s resources for your application.
- {{ cookiecutter.impact_level }} : The {{ cookiecutter.impact_level }} cluster agnostic k8s resources for your application.
* If you have a postgres database, these are the resources injected to mission-bootstrap project to instantiate your apps database. It will create a psql database called {{cookiecutter.project_name.replace('-', '_')}}_db with the following users and passwords loaded to the respective env variable in the container that connects to the database:
- PGHOST
- PGPORT
- PG_DATABASE
- PG_USER (Pass Var: APP_DB_ADMIN_PASSWORD)
- PG_RW_USER (Pass Var: APP_DB_RW_PASSWORD)
- PG_RO_USER (Pass Var: APP_DB_RO_PASSWORD)
* If you have a MySQL database, these are the resources injected to mission-bootstrap project to instantiate your apps database. It will create a mysql database called {{cookiecutter.project_name.replace('-', '_')}}_db with the following users and passwords loaded to the respective env variable in the container that connects to the database:
- MYSQL_HOST
- MYSQL_PORT
- MYSQL_DB_NAME
- MYSQL_DB_ADMIN_USER (Pass Var: MYSQL_DB_ADMIN_PASSWORD)
- MYSQL_DB_RW_USER (Pass Var: MYSQL_DB_RW_PASSWORD)
- MYSQL_DB_RO_USER (Pass Var: MYSQL_DB_RO_PASSWORD)
* If you have minio, these are the resources injected to mission-bootstrap project to instantiate minio.
- accesskey
- secretkey
- MINIO_ENDPOINT_URL
- S3_BUCKET=minio-{{cookiecutter.project_name}}-{{ cookiecutter.impact_level }}-staging
- S3_REGION=us-gov-west-1
* If you have elasticsearch enabled, these are the resources injected to mission-bootstrap project to instantiate elasticsearch.
- ELASTICSEARCH_URL="http://elasticsearch:9200"
- ELASTICSEARCH_HOSTNAME="elasticsearch"
- ELASTICSEARCH_PORT="9200"
* If you have mongodb enabled, these are the resources injected to mission-bootstrap project to instantiate mongodb.
- MONGO_URL="mongodb://mongodb:27017"
## What's next?
If you haven't already, you need to make sure your application is passing the official P1 pipelines. CTF will needed for production, but you can get to staging and get an internet accessible url as long as you are passing pipeline tests.
- With pipelines green, an infrastructure team member can add a deploy stage to the end of the pipeline to upload your release candidate image to the container registry on THIS project, and release images to the mission-bootstrap project's container registry.
The last step before deployment is to verify that pipelines can push generated images to respective container registry and that the pipeline automatically increments image tags on manifests.
Then the final step is for an infrastructure team to merge in your application to mission-bootstrap master from the automatically generated branch dev-LZ-{{cookiecutter.project_name}} in that repo. By default, manifests have commented out all k8s resources to ensure nothing is instantiated by accident. This needs to be undone in, for example, `mission-bootstrap/staging/{{ cookiecutter.impact_level }}/kustomization.yaml`.
At this point, your app should be live in staging! The default url is https://{{cookiecutter.project_name}}.staging.dso.mil
## How to manage
Eventually, application teams will be able to control these manifests fully, but until some policy constraints are worked out, an infrastructure team member will need to make merges into master. The master branch is used for the staging cluster and the release branch is used by production.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment