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

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,6 @@
variables:
- &vlang_image 'chewingbever/vlang:0.3'
platform: 'linux/amd64' platform: 'linux/amd64'
branches: branches:
exclude: [ main ] exclude: [ main ]
@ -9,7 +12,7 @@ skip_clone: true
pipeline: pipeline:
generate: generate:
image: 'chewingbever/vlang:0.3' image: *vlang_image
pull: true pull: true
commands: commands:
- curl -o vieter -L "https://s3.rustybever.be/vieter/commits/$CI_COMMIT_SHA/vieter-linux-amd64" - 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: matrix:
PLATFORM: PLATFORM:
- 'linux/amd64' - 'linux/amd64'
@ -9,7 +12,7 @@ platform: ${PLATFORM}
pipeline: pipeline:
install-modules: install-modules:
image: 'chewingbever/vlang:0.3' image: *vlang_image
pull: true pull: true
commands: commands:
- export VMODULES=$PWD/.vmodules - export VMODULES=$PWD/.vmodules
@ -18,7 +21,7 @@ pipeline:
event: [pull_request] event: [pull_request]
test: test:
image: 'chewingbever/vlang:0.3' image: *vlang_image
pull: true pull: true
commands: commands:
- export VMODULES=$PWD/.vmodules - 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 * Refactor of web framework
* API endpoints now return id of newly created entries * API endpoints now return id of newly created entries
* Repo POST requests now return information on published package * 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 ### Removed

View File

@ -112,6 +112,17 @@ id | ID of requested log
## Publish build log ## Publish build log
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
<aside class="warning"> <aside class="warning">
You should probably not use this endpoint, as it's used by the build system to 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 ## Create a new target
> JSON output format
```json
{
"message": "",
"data": {
"id": 15
}
}
```
Create a new target with the given data. Create a new target with the given data.
### HTTP Request ### 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 // Escape each query param
for k, v in params { for k, v in params {
// An empty parameter should be the same as not providing it at all // 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' 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. // put_package handles publishing a package to a repository.
['/:repo/publish'; auth; post] ['/:repo/publish'; auth; post]
fn (mut app App) put_package(repo string) web.Result { 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 := '' mut pkg_path := ''
if length := app.req.header.get(.content_length) { if length := app.req.header.get(.content_length) {