Skip to content

Commit

Permalink
Merge branch 'main' into api-test-assessment
Browse files Browse the repository at this point in the history
  • Loading branch information
aufi committed Dec 14, 2023
2 parents 6e38866 + b59c2c7 commit 86e2b95
Show file tree
Hide file tree
Showing 209 changed files with 21,907 additions and 4,775 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
DISCONNECTED=1 make run &
sleep 15 # probably a dirty solution
HUB_BASE_URL=http://localhost:8080 make test-api
HUB_BASE_URL=http://localhost:8080 make test-api # Intentionaly run 2x to catch data left in Hub DB.
test-e2e:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -93,3 +94,4 @@ jobs:
uses: konveyor/ci/.github/workflows/global-ci.yml@main
with:
component_name: tackle2-hub
api_hub_tests_ref: refs/pull/${{ github.ref_name }}
1 change: 1 addition & 0 deletions .github/workflows/test-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ jobs:
DISCONNECTED=1 make run &
sleep 15 # probably a dirty solution
HUB_BASE_URL=http://localhost:8080 make test-api
HUB_BASE_URL=http://localhost:8080 make test-api # Intentionaly run 2x to catch data left in Hub DB.
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
ARG SEED_ROOT=/opt/app-root/src/tackle2-seed
FROM registry.access.redhat.com/ubi9/go-toolset:latest as builder
ENV GOPATH=$APP_ROOT
COPY --chown=1001:0 . .
RUN make docker
RUN git clone https://github.com/konveyor/tackle2-seed
ARG SEED_PROJECT=konveyor/tackle2-seed
ARG SEED_BRANCH=main
ARG SEED_ROOT
RUN if [ ! -d "${SEED_ROOT}" ]; then \
git clone --branch ${SEED_BRANCH} https://github.com/${SEED_PROJECT} ${SEED_ROOT}; \
fi

FROM quay.io/konveyor/static-report as report

FROM registry.access.redhat.com/ubi9/ubi-minimal
ARG SEED_ROOT
COPY --from=builder /opt/app-root/src/bin/hub /usr/local/bin/tackle-hub
COPY --from=builder /opt/app-root/src/auth/roles.yaml /tmp/roles.yaml
COPY --from=builder /opt/app-root/src/auth/users.yaml /tmp/users.yaml
COPY --from=builder /opt/app-root/src/tackle2-seed/resources/ /tmp/seed
COPY --from=builder ${SEED_ROOT}/resources/ /tmp/seed
COPY --from=report /usr/local/static-report /tmp/analysis/report

RUN microdnf -y install \
Expand Down
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ controller-gen:
addon: fmt vet
go build -o bin/addon github.com/konveyor/tackle2-hub/hack/cmd/addon

docs: docs-swagger docs-binding
docs: docs-html docs-openapi3 docs-binding

# Build Swagger API spec into ./docs directory
docs-swagger:
${GOBIN}/swag init -g api/base.go
${GOBIN}/swag init -g pkg.go --dir api,assessment

# Build OpenAPI 3.0 docs
docs-openapi3: docs-swagger
curl -X POST -H "Content-Type: application/json" -d @docs/swagger.json https://converter.swagger.io/api/convert | jq > docs/openapi3.json

# Build HTML docs from Swagger API spec
docs-html: docs-swagger
redoc-cli bundle -o docs/index.html docs/swagger.json
docs-html: docs-openapi3
redoc-cli bundle -o docs/index.html docs/openapi3.json

# Build binding doc.
docs-binding:
Expand Down Expand Up @@ -131,7 +135,7 @@ test:

# Run Hub REST API tests.
test-api:
HUB_BASE_URL=${HUB_BASE_URL} go test -count=1 -v ./test/api/...
HUB_BASE_URL=${HUB_BASE_URL} go test -count=1 -p=1 -v ./test/api/...

# Run Hub test suite.
test-all: test-unit test-api
Expand Down
4 changes: 4 additions & 0 deletions addon/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Tackle hub/addon integration.
package addon

import (
logapi "github.com/go-logr/logr"
"github.com/jortel/go-utils/logr"
"github.com/konveyor/tackle2-hub/binding"
"github.com/konveyor/tackle2-hub/settings"
Expand Down Expand Up @@ -67,6 +68,8 @@ type Filter = binding.Filter
type Adapter struct {
// Task API.
Task
// Log API.
Log logapi.Logger
// Settings API.
Setting Setting
// Application API.
Expand Down Expand Up @@ -141,6 +144,7 @@ func newAdapter() (adapter *Adapter) {
Task: Task{
richClient: richClient,
},
Log: Log,
Setting: richClient.Setting,
Application: richClient.Application,
Identity: richClient.Identity,
Expand Down
16 changes: 8 additions & 8 deletions api/adoptionplan.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ func (h AdoptionPlanHandler) AddRoutes(e *gin.Engine) {
routeGroup.POST(AdoptionPlansRoot, h.Graph)
}

// Get godoc
// Graph godoc
// @summary Generate an application dependency graph arranged in topological order.
// @description Graph generates an application dependency graph arranged in topological order.
// @tags adoptionplans
// @produce json
// @success 200 {object} api.DependencyGraph
// @success 200 {object} []api.Vertex
// @router /adoptionplans [post]
// @param requestedApps path array true "requested App IDs"
// @param requestedApps body []uint true "List of requested App IDs"
func (h AdoptionPlanHandler) Graph(ctx *gin.Context) {
var requestedApps []struct {
ApplicationID uint `json:"applicationId"`
Expand Down Expand Up @@ -113,13 +113,13 @@ func (h AdoptionPlanHandler) Graph(ctx *gin.Context) {
//
// Vertex represents a vertex in the dependency graph.
type Vertex struct {
ID uint `json:"applicationId"`
Name string `json:"applicationName"`
ID uint `json:"applicationId" yaml:"applicationId"`
Name string `json:"applicationName" yaml:"applicationName"`
Decision string `json:"decision"`
EffortEstimate string `json:"effortEstimate"`
EffortEstimate string `json:"effortEstimate" yaml:"effortEstimate"`
Effort int `json:"effort"`
PositionY int `json:"positionY"`
PositionX int `json:"positionX"`
PositionY int `json:"positionY" yaml:"positionY"`
PositionX int `json:"positionX" yaml:"positionX"`
}

//
Expand Down
Loading

0 comments on commit 86e2b95

Please sign in to comment.