Skip to content

Commit

Permalink
Added TaskImage for AWS and an ability to use asterisk in image plus …
Browse files Browse the repository at this point in the history
…fixes (#74)

The change adds an ability to request Aquarium to prepare Image just like Snapshot before. This should help with automated building of the images with embedded caches.

Features:
* Encryption (re-encryption) - so even if you using not encrypted images as a base - the produced one will be encrypted
* Latest image by the name with asterisk - actually AWS feature, but now logic tries to find the latest image if there is multiple of them in the return.

Other changes:
* Fixed a couple of issues with openapi spec that failed the jenkins plugin build and added openapi spec yaml validation to CI.
* Switched to the newest version of openapi-codegen. Also tried ogen and it could solve some issues with code generation, but needs a major rewrite to use it (#75).
* Added new API call to get tasks by ID - that helps to wait and find out how the task completed and what's the image name/id we've got.
* Added more logging to tasks to keep track of their execution.
* Made sure NodeFilter field in Resources will not return null and just empty list as described in spec.
* Small fix to not print timestamps in debug mode if we don't need timestamps.
  • Loading branch information
sparshev authored Aug 6, 2024
1 parent fb07ac5 commit 557e014
Show file tree
Hide file tree
Showing 19 changed files with 607 additions and 138 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

jobs:
CodeQL:
name: CodeQL validation
runs-on: ubuntu-latest
permissions:
security-events: write
Expand All @@ -23,6 +24,28 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3

OpenAPI:
runs-on: ubuntu-latest
name: OpenAPI validation

# Service containers to run with `runner-job`
services:
# Label used to access the service container
swagger-editor:
# Docker Hub image
image: swaggerapi/swagger-editor
ports:
# Maps port 8080 on service container to the host 80
- 80:8080

steps:
- uses: actions/checkout@v2
- name: Validate OpenAPI definition
uses: swaggerexpert/swagger-editor-validate@452076dc45d5d1f09dd55440c9bffc372de4da25 # Jul 29, 2024
with:
swagger-editor-url: http://localhost/
definition-file: docs/openapi.yaml

Build:
runs-on: ubuntu-latest
steps:
Expand All @@ -46,7 +69,7 @@ jobs:

- name: Test
run: |
go install github.com/jstemmer/go-junit-report/v2@latest
go install github.com/jstemmer/go-junit-report/v2@85bf471 # Oct 18, 2023
name="$(ls aquarium-fish-*.linux_amd64)"
FISH_PATH="$PWD/$name" go test -v -failfast -parallel 4 -count=1 ./tests/... 2>&1 | go-junit-report -iocopy -set-exit-code -out report.xml
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export CGO_ENABLED=0
echo "--- GENERATE CODE FOR AQUARIUM-FISH ---"
# Install oapi-codegen if it's not available or version is not the same with go.mod
gopath=$(go env GOPATH)
req_ver=$(grep -F 'github.com/deepmap/oapi-codegen' go.mod | cut -d' ' -f 2)
req_ver=$(grep -F 'github.com/oapi-codegen/oapi-codegen/v2' go.mod | cut -d' ' -f 2)
curr_ver="$(PATH="$gopath/bin:$PATH" oapi-codegen --version 2>/dev/null | tail -1 || true)"
if [ "$curr_ver" != "$req_ver" ]; then
go install "github.com/deepmap/oapi-codegen/cmd/oapi-codegen@$req_ver"
go install "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@$req_ver"
fi
# Cleanup the old generated files
find ./lib -name '*.gen.go' -delete
Expand Down
31 changes: 30 additions & 1 deletion docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,35 @@ paths:
security:
- basic_auth: []

/api/v1/task/{task_uid}:
get:
summary: Get ApplicationTask data
description: Returns the Application Task
operationId: ApplicationTaskGet
tags:
- Application
parameters:
- name: task_uid
in: path
description: UID of the Task
required: true
schema:
type: string
format: uuid
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ApplicationTask'
'401':
$ref: '#/components/responses/UnauthorizedError'
'404':
description: ApplicationTask not found
security:
- basic_auth: []

/api/v1/application/{uid}/deallocate:
get:
summary: Triggers Application deallocate
Expand Down Expand Up @@ -745,7 +774,7 @@ paths:
- name: handler
in: path
description: Which pprof handler to use. If empty - will show index
required: false
required: true
schema:
type: string
responses:
Expand Down
31 changes: 16 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ require (
github.com/aws/aws-sdk-go-v2/service/kms v1.32.3
github.com/aws/aws-sdk-go-v2/service/servicequotas v1.21.10
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12
github.com/deepmap/oapi-codegen v1.12.4
github.com/getkin/kin-openapi v0.115.0
github.com/getkin/kin-openapi v0.124.0
github.com/ghodss/yaml v1.0.0
github.com/glebarez/sqlite v1.7.0
github.com/google/uuid v1.3.0
github.com/google/uuid v1.5.0
github.com/gorilla/websocket v1.4.0
github.com/hpcloud/tail v1.0.0
github.com/labstack/echo/v4 v4.10.2
github.com/labstack/echo/v4 v4.11.4
github.com/mostlygeek/arp v0.0.0-20170424181311-541a2129847a
github.com/oapi-codegen/oapi-codegen/v2 v2.3.0
github.com/oapi-codegen/runtime v1.1.1
github.com/rqlite/sql v0.0.0-20221103124402-8f9ff0ceb8f0
github.com/shirou/gopsutil/v3 v3.23.1
github.com/spf13/cobra v1.7.0
github.com/steinfletcher/apitest v1.5.15
github.com/ulikunitz/xz v0.5.11
golang.org/x/crypto v0.8.0
golang.org/x/net v0.9.0
golang.org/x/crypto v0.17.0
golang.org/x/net v0.19.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/gorm v1.24.6
)
Expand All @@ -42,22 +43,22 @@ require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/glebarez/go-sqlite v1.20.3 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/go-openapi/jsonpointer v0.20.2 // indirect
github.com/go-openapi/swag v0.22.8 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/invopop/yaml v0.1.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230126093431-47fa9a501578 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -66,9 +67,9 @@ require (
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit 557e014

Please sign in to comment.