Merge pull request 'Some small fixes' (#273) from Chewing_Bever/vieter:explicitely-empty-values into dev

Reviewed-on: vieter-v/vieter#273
Jef Roosens 2022-10-01 16:56:25 +02:00
commit 7ef7dcd725
15 changed files with 60 additions and 14 deletions

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
matrix:
PLATFORM:
- 'linux/amd64'
@ -7,7 +10,7 @@ platform: ${PLATFORM}
pipeline:
install-modules:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
@ -16,7 +19,7 @@ pipeline:
event: [push, pull_request]
debug:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
commands:
- export VMODULES=$PWD/.vmodules
- make
@ -26,7 +29,7 @@ pipeline:
exclude: [main]
prod:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
environment:
- LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static
commands:
@ -44,7 +47,7 @@ pipeline:
event: [push, pull_request]
upload:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
secrets: [ s3_username, s3_password ]
commands:
# https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
platform: 'linux/amd64'
branches:
exclude: [ main ]
@ -11,7 +14,7 @@ pipeline:
- make docs
api-docs:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
group: 'generate'
commands:

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
platform: 'linux/amd64'
branches: [ 'main' ]
depends_on:
@ -8,7 +11,7 @@ skip_clone: true
pipeline:
prepare:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
secrets: [ s3_username, s3_password ]
commands:

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
# These checks already get performed on the feature branches
branches:
exclude: [ main ]
@ -5,7 +8,7 @@ platform: 'linux/amd64'
pipeline:
lint:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
commands:
- make lint

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
platform: 'linux/amd64'
branches:
exclude: [ main ]
@ -9,7 +12,7 @@ skip_clone: true
pipeline:
generate:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
commands:
- curl -o vieter -L "https://s3.rustybever.be/vieter/commits/$CI_COMMIT_SHA/vieter-linux-amd64"

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
matrix:
PLATFORM:
- 'linux/amd64'
@ -9,7 +12,7 @@ platform: ${PLATFORM}
pipeline:
install-modules:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules
@ -18,7 +21,7 @@ pipeline:
event: [pull_request]
test:
image: 'chewingbever/vlang:0.3'
image: *vlang_image
pull: true
commands:
- export VMODULES=$PWD/.vmodules

View File

@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Refactor of web framework
* API endpoints now return id of newly created entries
* Repo POST requests now return information on published package
* `api` can no longer be used as a repository name
* CLI client now allows setting values to an empty value
### Removed

View File

@ -112,6 +112,17 @@ id | ID of requested log
## Publish build log
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
<aside class="warning">
You should probably not use this endpoint, as it's used by the build system to

View File

@ -100,6 +100,17 @@ id | id of requested target
## Create a new target
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
Create a new target with the given data.
### HTTP Request

View File

@ -30,12 +30,10 @@ fn (c &Client) send_request_raw(method Method, url string, params map[string]str
// Escape each query param
for k, v in params {
// An empty parameter should be the same as not providing it at all
if v != '' {
params_escaped[k] = urllib.query_escape(v)
}
params_escaped[k] = urllib.query_escape(v)
}
params_str := params_escaped.keys().map('$it=${params[it]}').join('&')
params_str := params_escaped.keys().map('$it=${params_escaped[it]}').join('&')
full_url = '$full_url?$params_str'
}

View File

@ -50,6 +50,12 @@ fn (mut app App) get_repo_file(repo string, arch string, filename string) web.Re
// put_package handles publishing a package to a repository.
['/:repo/publish'; auth; post]
fn (mut app App) put_package(repo string) web.Result {
// api is a reserved keyword for api routes & should never be allowed to be
// a repository.
if repo.to_lower() == 'api' {
return app.json(.bad_request, new_response("'api' is a reserved keyword & cannot be used as a repository name."))
}
mut pkg_path := ''
if length := app.req.header.get(.content_length) {