From b874cdc7d3894f3309a65149bbc612790a0f89c8 Mon Sep 17 00:00:00 2001 From: djmarinb Date: Wed, 22 Dec 2021 08:56:49 +0100 Subject: [PATCH 1/2] Fixed CircleCI configuration to allow uppercase branches --- .circleci/config.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0e5238882..1244dd358 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -146,7 +146,8 @@ jobs: - run: make test-runtime-image gateway-logs --keep-going - login-docker: command: | - IMAGE_TAG="${CIRCLE_TAG:-${CIRCLE_BRANCH}}" + CIRCLE_BRANCH_LOWER=`echo $CIRCLE_BRANCH | tr '[:upper:]' '[:lower:]'` + IMAGE_TAG="${CIRCLE_TAG:-${CIRCLE_BRANCH_LOWER}}" if [ "${IMAGE_TAG}" == "master" ] then IMAGE_TAG="latest" @@ -179,7 +180,8 @@ jobs: - login-docker: command: | - IMAGE_TAG="${CIRCLE_TAG:-${CIRCLE_BRANCH}}-builder" + CIRCLE_BRANCH_LOWER=`echo $CIRCLE_BRANCH | tr '[:upper:]' '[:lower:]'` + IMAGE_TAG="${CIRCLE_TAG:-${CIRCLE_BRANCH_LOWER}}-builder" if [ "${IMAGE_TAG}" == "master-builder" ] then IMAGE_TAG="latest-builder" @@ -281,7 +283,7 @@ jobs: machine: true steps: - checkout - - run: IMAGE_TAG=${CIRCLE_TAG:-${CIRCLE_BRANCH}} make benchmark + - run: IMAGE_TAG=`echo $CIRCLE_BRANCH | tr '[:upper:]' '[:lower:]'` make benchmark - run: IMAGE_TAG=master make benchmark - store_artifacts: path: tmp/benchmark From 22e39cb0c084b21c9953ac9debb3aac27325f432 Mon Sep 17 00:00:00 2001 From: djmarinb Date: Mon, 20 Dec 2021 13:49:45 +0100 Subject: [PATCH 2/2] THREESCALE-7906 Under some error circumstances (like 414 Request-URI Too Large) the access log were generated in a phase previous to having defined the access_log_enabled and the extended_access_logs_enabled. This causes a warning to arise, but most importanty, prevented that acces to be logged. We use the workarround of declaring the variables as a map with a default value because maps can be used in the http context and therefore will be available and initialized even on the given error case. --- CHANGELOG.md | 1 + gateway/http.d/apicast.conf.liquid | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 731944b03..b98f9d34e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed issues with OIDC filters [PR #1304](https://github.com/3scale/APIcast/pull/1304) [THREESCALE-6042](https://issues.redhat.com/browse/THREESCALE-6042) - Fixed issues with Upstream MTLS certs [PR #1307](https://github.com/3scale/APIcast/pull/1307) [THREESCALE-7508](https://issues.redhat.com/browse/THREESCALE-7508) +- Fixed warning messages [PR #1318](https://github.com/3scale/APIcast/pull/1318) [THREESCALE-7906](https://issues.redhat.com/browse/THREESCALE-7906) ### Added diff --git a/gateway/http.d/apicast.conf.liquid b/gateway/http.d/apicast.conf.liquid index 632d05a17..0276aa722 100644 --- a/gateway/http.d/apicast.conf.liquid +++ b/gateway/http.d/apicast.conf.liquid @@ -1,9 +1,20 @@ log_format time '[$time_local] $target_host:$server_port $remote_addr:$remote_port "$request" $status $body_bytes_sent ($request_time) $post_action_impact'; -map $status $extended_access_log { +# Use maps as variables because some logs can be raised out of the server context +# where variables cannot be set, this allow us to avoid a warning +map "" $extended_access_log { default ''; } +map "" $access_logs_enabled { + default '1'; +} + +map "" $extended_access_logs_enabled { + default '0'; +} + + log_format extended escape=none '$extended_access_log'; server { @@ -50,9 +61,7 @@ server { server { {% capture log_buffer %} {%if log_buffer_size %}buffer={{ log_buffer_size }} {% endif %} {% endcapture %} - set $access_logs_enabled '1'; access_log {{ access_log_file | default: "/dev/stdout" }} time if=$access_logs_enabled {{ log_buffer }}; - set $extended_access_logs_enabled '0'; access_log {{ access_log_file | default: "/dev/stdout" }} extended if=$extended_access_logs_enabled {{ log_buffer }}; {%- assign http_port = port.apicast | default: 8080 %}