From c33abe2f29853ed5bb7d09d62a477d310d8c207b Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sat, 18 May 2019 12:07:19 +0900 Subject: [PATCH 01/27] Update docker-compose. --- docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index bc86cd4..b2f64bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,5 +21,6 @@ services: volumes: - .:/tmp/redmine/plugins/redmine_banner ports: - - 3000:3000 + - "3000:3000" + From d8cf9bbf5723e92238a63aeb07f5bbde0a1dc3d5 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Fri, 16 Aug 2019 21:48:54 +0900 Subject: [PATCH 02/27] Remove unused files. --- _config.yml | 1 - _layouts/default.html | 61 ------------------------------------------- 2 files changed, 62 deletions(-) delete mode 100644 _config.yml delete mode 100644 _layouts/default.html diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 2f7efbe..0000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-minimal \ No newline at end of file diff --git a/_layouts/default.html b/_layouts/default.html deleted file mode 100644 index c2a5ecf..0000000 --- a/_layouts/default.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - -{% seo %} - - - - -
-
-

{{ site.title | default: site.github.repository_name }}

- - {% if site.logo %} - Logo - {% endif %} - -

{{ site.description | default: site.github.project_tagline }}

- - {% if site.github.is_user_page %} -

View My GitHub Profile

- {% endif %} - - {% if site.show_downloads %} - - {% endif %} -
-
- - {{ content }} - -
- -
- - {% if site.google_analytics %} - - {% endif %} - - From b8a6ace5ec27fd1a359ee11c30a3a19e0aa6949c Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Fri, 16 Aug 2019 21:54:59 +0900 Subject: [PATCH 03/27] Add setting to ignore build. --- .circleci/config.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 367e622..a785f6b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -60,7 +60,11 @@ workflows: version: 2 build_and_test: jobs: - - build + - build: + filters: + branches: + ignore: + - /ignore-build-*/ - test: requires: - build From 1abbc3aaecdd3102334bbf95c4a83a7937bfc948 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sat, 17 Aug 2019 18:38:48 +0900 Subject: [PATCH 04/27] Add plugin source into docker image. --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index f42f4d9..90f7e2d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get install -qq -y build-essential libc6-dev RUN cd /tmp && svn co http://svn.redmine.org/redmine/branches/4.0-stable/ redmine WORKDIR /tmp/redmine +COPY . /tmp/redmine/plugins/redmine_banner/ # add database.yml (for development, development with mysql, test) RUN echo $'test:\n\ From d3465603ab560a5906b670df08190cc052224098 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sat, 17 Aug 2019 18:45:27 +0900 Subject: [PATCH 05/27] Update ignore setting. --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a785f6b..6d89b3b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,7 +64,7 @@ workflows: filters: branches: ignore: - - /ignore-build-*/ + - /ignore-build-.*/ - test: requires: - build From 7c3277b46e86ae0682d7c7bcb64e482969461f9b Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sat, 17 Aug 2019 21:54:14 +0900 Subject: [PATCH 06/27] Update version to 2.1 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d89b3b..4d4bce7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ # # Check https://circleci.com/docs/2.0/language-ruby/ for more details # -version: 2 +version: 2.1 general: artifacts: From d076199adfd90b73e60edff861492967ff6df2ee Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sat, 17 Aug 2019 22:21:02 +0900 Subject: [PATCH 07/27] Add config to build and push docker image to ecr. --- .circleci/config.yml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d4bce7..770b184 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,6 +2,9 @@ # # Check https://circleci.com/docs/2.0/language-ruby/ for more details # +orbs: + aws-ecr: circleci/aws-ecr@6.2.0 + version: 2.1 general: @@ -57,8 +60,7 @@ jobs: path: /tmp/coverage workflows: - version: 2 - build_and_test: + build_test_push: jobs: - build: filters: @@ -72,4 +74,17 @@ workflows: branches: ignore: - /v0.1.x-support-Redmine3.*/ + - aws-ecr/build-and-push-image: + account-url: AWS_ECR_ACCOUNT_URL + aws-access-key-id: AWS_ACCESS_KEY_ID + aws-secret-access-key: AWS_SECRET_ACCESS_KEY + create-repo: true + dockerfile: Dockerfile + path: . + region: AWS_REGION + repo: redmine_banner + + requires: + - test + From d160a0a4350ea3a8ae1797dc1631bf7c2c26a32e Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sat, 17 Aug 2019 23:55:14 +0900 Subject: [PATCH 08/27] Update Dockerfile. Enabled to run without any arguments, just command 'docker run'. --- Dockerfile | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 90f7e2d..7f31aab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,19 @@ +# +# docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) \ +# --build-arg=BRANCH=$(git name-rev --name-only HEAD) -t akiko/redmine_banner:latest . +# +# FROM ruby:2.5 LABEL maintainer="AKIKO TAKANO / (Twitter: @akiko_pusu)" \ description="Image to run Redmine simply with sqlite to try/review plugin." +ARG BRANCH="master" +ARG COMMIT="unknown" + +ENV COMMIT_SHA=${COMMIT} +ENV COMMIT_BRANCH=${BRANCH} + + ### get Redmine source ### Replace shell with bash so we can source files ### RUN rm /bin/sh && ln -s /bin/bash /bin/sh @@ -27,16 +39,17 @@ RUN echo $'test:\n\ development:\n\ adapter: sqlite3\n\ database: /tmp/data/redmine_development.sqlite3\n\ - encoding: utf8mb4\n\ -development_mysql:\n\ - adapter: mysql2\n\ - host: mysql\n\ - password: pasword\n\ - database: redemine_development\n\ - username: root\n'\ + encoding: utf8mb4\n'\ >> config/database.yml RUN gem update bundler -RUN bundle install --without postgresql rmagick +RUN bundle install --without postgresql rmagick mysql RUN bundle exec rake db:migrate - +RUN bundle exec rake redmine:plugins:migrate +RUN bundle exec rake generate_secret_token +RUN VERSION=$(cd plugins/redmine_banner && git rev-parse --short HEAD) && \ + bundle exec rails runner \ + "Setting.send('plugin_redmine_banner=', {enable: 'true', type: 'info', display_part: 'both', banner_description: 'This is a test message for Global Banner. (${COMMIT_BRANCH}:${COMMIT_SHA})'}.stringify_keys)" + +EXPOSE 3000 +CMD ["rails", "server", "-b", "0.0.0.0"] From 8f00c850890b9e162540986668f6250ead8fb524 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sun, 18 Aug 2019 01:01:31 +0900 Subject: [PATCH 09/27] Remove unused layer. --- Dockerfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7f31aab..f47c8b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,10 +21,9 @@ RUN rm /bin/sh && ln -s /bin/bash /bin/sh ### install default sys packeges ### RUN apt-get update -RUN apt-get install -qq -y \ +RUN apt-get install -qq -y --no-install-recommends \ git vim subversion \ - sqlite3 default-libmysqlclient-dev -RUN apt-get install -qq -y build-essential libc6-dev + sqlite3 && rm -rf /var/lib/apt/lists/* RUN cd /tmp && svn co http://svn.redmine.org/redmine/branches/4.0-stable/ redmine WORKDIR /tmp/redmine @@ -44,9 +43,8 @@ development:\n\ RUN gem update bundler RUN bundle install --without postgresql rmagick mysql -RUN bundle exec rake db:migrate -RUN bundle exec rake redmine:plugins:migrate -RUN bundle exec rake generate_secret_token +RUN bundle exec rake db:migrate && bundle exec rake redmine:plugins:migrate \ + && bundle exec rake generate_secret_token RUN VERSION=$(cd plugins/redmine_banner && git rev-parse --short HEAD) && \ bundle exec rails runner \ "Setting.send('plugin_redmine_banner=', {enable: 'true', type: 'info', display_part: 'both', banner_description: 'This is a test message for Global Banner. (${COMMIT_BRANCH}:${COMMIT_SHA})'}.stringify_keys)" From 10e97db161b0430ee51f8d7b2780049d22d2730f Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sun, 18 Aug 2019 01:36:07 +0900 Subject: [PATCH 10/27] Pass build-args --- .circleci/config.yml | 2 +- Dockerfile | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 770b184..7972889 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,7 +83,7 @@ workflows: path: . region: AWS_REGION repo: redmine_banner - + extra-build-args: '--build-arg COMMIT=$CIRCLE_SHA1 --build-arg=BRANCH=$CIRCLE_BRANCH' requires: - test diff --git a/Dockerfile b/Dockerfile index f47c8b1..c2fa9ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -45,8 +45,7 @@ RUN gem update bundler RUN bundle install --without postgresql rmagick mysql RUN bundle exec rake db:migrate && bundle exec rake redmine:plugins:migrate \ && bundle exec rake generate_secret_token -RUN VERSION=$(cd plugins/redmine_banner && git rev-parse --short HEAD) && \ - bundle exec rails runner \ +RUN bundle exec rails runner \ "Setting.send('plugin_redmine_banner=', {enable: 'true', type: 'info', display_part: 'both', banner_description: 'This is a test message for Global Banner. (${COMMIT_BRANCH}:${COMMIT_SHA})'}.stringify_keys)" EXPOSE 3000 From 7b218b0fa7c2b1808587604412c6637c41ab97e5 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Sun, 18 Aug 2019 12:42:56 +0900 Subject: [PATCH 11/27] Update admin's password . --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index c2fa9ac..222760f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,5 +48,9 @@ RUN bundle exec rake db:migrate && bundle exec rake redmine:plugins:migrate \ RUN bundle exec rails runner \ "Setting.send('plugin_redmine_banner=', {enable: 'true', type: 'info', display_part: 'both', banner_description: 'This is a test message for Global Banner. (${COMMIT_BRANCH}:${COMMIT_SHA})'}.stringify_keys)" +# Change Admin's password to 'redmine_banner_${COMMIT_SHA}' +RUN bundle exec rails runner \ + "User.find_by_login('admin').update!(password: 'redmine_banner_${COMMIT_SHA}', must_change_passwd: false)" + EXPOSE 3000 CMD ["rails", "server", "-b", "0.0.0.0"] From a48f4f917b8a6582ebc60119bc42807a7e7286d7 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 10:12:36 +0900 Subject: [PATCH 12/27] Fixed typo. This message should be for banner plugin. --- init.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.rb b/init.rb index fbb1c22..8c96033 100644 --- a/init.rb +++ b/init.rb @@ -4,7 +4,7 @@ require 'banners/projects_helper_patch' # NOTE: Keep error message for a while to support Redmine3.x users. -def issue_template_version_message(original_message = nil) +def banner_version_message(original_message = nil) <<-"USAGE" ========================== #{original_message} @@ -45,6 +45,6 @@ def issue_template_version_message(original_message = nil) permission :manage_banner, { banner: %I[show edit project_banner_off] }, require: :member end rescue ::Redmine::PluginRequirementError => e - raise ::Redmine::PluginRequirementError.new(issue_template_version_message(e.message)) # rubocop:disable Style/RaiseArgs + raise ::Redmine::PluginRequirementError.new(banner_version_message(e.message)) # rubocop:disable Style/RaiseArgs end end From e353e29cae0abd52c56dbac88cf5d48a10e12183 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 10:13:11 +0900 Subject: [PATCH 13/27] Prevent date format exception. --- lib/banners/banner_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/banners/banner_helper.rb b/lib/banners/banner_helper.rb index e9343fb..573d4cb 100644 --- a/lib/banners/banner_helper.rb +++ b/lib/banners/banner_helper.rb @@ -1,7 +1,11 @@ module Banners module BannerHelper def get_time(ymd, h, m) - d = Date.strptime(ymd, '%Y-%m-%d') + begin + d = Date.strptime(ymd, '%Y-%m-%d') + rescue + d = Date.current + end Time.mktime(d.year, d.month, d.day, h.to_i, m.to_i) end From ba64070a2f753191eaa6460ec83a793ebefed3a0 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 10:44:56 +0900 Subject: [PATCH 14/27] Fixed format. Update rubocop setting. --- .rubocop.yml | 3 +-- lib/banners/banner_helper.rb | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index bbce20b..7cd3c92 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,6 @@ inherit_from: .rubocop_todo.yml AllCops: - # TODO: Change TargetRubyVersion to 2.0 or higher, when Redmine cloded to support ruby 1.9x. - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.3 Style/IfUnlessModifier: Enabled: false diff --git a/lib/banners/banner_helper.rb b/lib/banners/banner_helper.rb index 573d4cb..9bee245 100644 --- a/lib/banners/banner_helper.rb +++ b/lib/banners/banner_helper.rb @@ -1,12 +1,15 @@ +# frozen_string_literal: true + module Banners module BannerHelper - def get_time(ymd, h, m) + def get_time(ymd, hour, minute) begin d = Date.strptime(ymd, '%Y-%m-%d') - rescue + rescue StandardError => e + logger.warn("Passed value #{ymd} for Banner has wrong format. #{e.message}") d = Date.current end - Time.mktime(d.year, d.month, d.day, h.to_i, m.to_i) + Time.mktime(d.year, d.month, d.day, hour.to_i, minute.to_i) end def enabled?(project) From 2e5fe511221f399659d63e4853db431898577909 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 11:07:01 +0900 Subject: [PATCH 15/27] Add workaround to #111. --- init.rb | 6 ++++++ lib/banners/settings_controller_patch.rb | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/init.rb b/init.rb index 8c96033..79ec564 100644 --- a/init.rb +++ b/init.rb @@ -44,6 +44,12 @@ def banner_version_message(original_message = nil) project_module :banner do permission :manage_banner, { banner: %I[show edit project_banner_off] }, require: :member end + + Rails.configuration.to_prepare do + unless SettingsController.included_modules.include?(Banners::SettingsControllerPatch) + SettingsController.send(:prepend, Banners::SettingsControllerPatch) + end + end rescue ::Redmine::PluginRequirementError => e raise ::Redmine::PluginRequirementError.new(banner_version_message(e.message)) # rubocop:disable Style/RaiseArgs end diff --git a/lib/banners/settings_controller_patch.rb b/lib/banners/settings_controller_patch.rb index 0b5aefb..9e074c4 100644 --- a/lib/banners/settings_controller_patch.rb +++ b/lib/banners/settings_controller_patch.rb @@ -91,4 +91,3 @@ def validate_date_range?(param_settings) end end -SettingsController.prepend Banners::SettingsControllerPatch From f61800a8744b98b8ba294902f01c19facadd5c5b Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 12:03:47 +0900 Subject: [PATCH 16/27] Update docker file and add README section. --- Dockerfile | 3 ++- README.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 222760f..190c329 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ LABEL maintainer="AKIKO TAKANO / (Twitter: @akiko_pusu)" \ description="Image to run Redmine simply with sqlite to try/review plugin." ARG BRANCH="master" -ARG COMMIT="unknown" +ARG COMMIT="commit_sha" ENV COMMIT_SHA=${COMMIT} ENV COMMIT_BRANCH=${BRANCH} @@ -49,6 +49,7 @@ RUN bundle exec rails runner \ "Setting.send('plugin_redmine_banner=', {enable: 'true', type: 'info', display_part: 'both', banner_description: 'This is a test message for Global Banner. (${COMMIT_BRANCH}:${COMMIT_SHA})'}.stringify_keys)" # Change Admin's password to 'redmine_banner_${COMMIT_SHA}' +# Default is 'redmine_banner_commit_sha' RUN bundle exec rails runner \ "User.find_by_login('admin').update!(password: 'redmine_banner_${COMMIT_SHA}', must_change_passwd: false)" diff --git a/README.md b/README.md index 186e005..ac266af 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,25 @@ NOTE: Mainly, maintenance, bugfix and refactoring only. There is no additional f * First release +### Quick try with using Docker + +You can try quickly this plugin with Docker environment. +Please try: + +```bash +# Admin password is 'redmine_banner_commit_sha' +$ https://github.com/akiko-pusu/redmine_banner +$ docker-compose up web -d + +# or +# +# Admin password is 'redmine_banner_{COMMIT}' +$ docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) \ + --build-arg=BRANCH=$(git name-rev --name-only HEAD) -t akiko/redmine_banner:latest . + +$ docker run -p 3000:3000 akiko/redmine_banner:latest +``` + ### Repository * From 19e1974d3f8b0c81319eb1d0caf71a355fb601c8 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 16:10:37 +0900 Subject: [PATCH 17/27] Add routing and controller to handle global banner. User should be belong to specified group. --- .../banners/api/global_banner_controller.rb | 64 +++++++++++++++++++ config/routes.rb | 11 ++++ 2 files changed, 75 insertions(+) create mode 100644 app/controllers/banners/api/global_banner_controller.rb diff --git a/app/controllers/banners/api/global_banner_controller.rb b/app/controllers/banners/api/global_banner_controller.rb new file mode 100644 index 0000000..6f6003d --- /dev/null +++ b/app/controllers/banners/api/global_banner_controller.rb @@ -0,0 +1,64 @@ +# frozen_string_literal: true + +module Banners + module Api + class GlobalBannerController < ApplicationController + before_action :require_login, :require_banner_admin + accept_api_auth :show, :register_banner + + def show + render json: global_banner_json + end + + def register_banner + global_banner_params = build_params + + retval = Setting.send('plugin_redmine_banner=', global_banner_params.stringify_keys) + + if retval + render status: 200, json: { status: 'OK', message: 'updatig the global banner' } + else + render status: 400, json: { status: 400, message: 'Bad Request' } + end + rescue StandardError => e + logger.warn("Global Banner Update failed. Caused: #{e.message}") + response_internal_server_error + end + + # TODO: Validation is required + def build_params + JSON.parse(request.body.read) + end + + def global_banner_json + Setting['plugin_redmine_banner'].to_json + end + + # 400 Bad Request + def response_bad_request + render status: 400, json: { status: 400, message: 'Bad Request' } + end + + # 401 Unauthorized + def response_unauthorized + render status: 401, json: { status: 401, message: 'Unauthorized' } + end + + # 500 Internal Server Error + def response_internal_server_error + render status: 500, json: { status: 500, message: 'Internal Server Error' } + end + + def require_banner_admin + return if User.current.admin? || banner_admin?(User.current) + + response_unauthorized + end + + def banner_admin?(user) + banner_admin_group = Group.find_by_lastname('GlobalBanner_Admin') + banner_admin_group.users.include?(user) + end + end + end +end diff --git a/config/routes.rb b/config/routes.rb index d695a50..ad2a00b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.routes.draw do concern :previewable do post 'preview', on: :collection @@ -17,4 +19,13 @@ post 'off', on: :collection get 'off', on: :collection end + + namespace 'banners' do + namespace 'api' do + resource :global_banner, only: %i[register_banner] do + put '/', to: 'global_banner#register_banner', on: :member + get '/', to: 'global_banner#show', on: :member + end + end + end end From a01a974a02fb421a57929b941df350d536a934ac Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 18:12:28 +0900 Subject: [PATCH 18/27] Add api doc as swagger doc. --- script/swagger.yml | 150 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 script/swagger.yml diff --git a/script/swagger.yml b/script/swagger.yml new file mode 100644 index 0000000..3e33c18 --- /dev/null +++ b/script/swagger.yml @@ -0,0 +1,150 @@ +swagger: "2.0" +info: + description: | + Here is a API to handle Redmine's site wide banner. + Now prototype version. + version: "1.0.0-α" + title: "GlobalBanner API" + termsOfService: "http://swagger.io/terms/" + contact: + email: "akiko.pusu@gmail.com" +schemes: + - "http" + - "https" +host: "localhost:3000" +paths: + /banners/api/global_banner.json: + get: + summary: "Show Global Banner setting" + description: | + Show Global Banner setting as JSON format stored in a settings table. + + Only Redmine Administrator or user assigned to group named **"GlobalBanner_Admin"** can use this api. + The way to authenticate follows Redmine itself. + - Exp. User parameter ?key=YOUR_API_KEY or HTTP Header: X-Redmine-API-Key and so on. + - Please see: http://www.redmine.org/projects/redmine/wiki/Rest_api#Authentication + parameters: + - name: "X-Redmine-API-Key" + in: "header" + description: "Your API KEY" + required: true + type: "string" + responses: + 200: + description: "Response in success" + schema: + type: "object" + properties: + banner_description: + type: "string" + example: "This is a sample message." + display_part: + type: "string" + example: "both" + enable: + type: "string" + example: "true" + end_hour: + type: "string" + example: "16" + end_min: + type: "string" + example: "31" + end_ymd: + type: "string" + example: "2019-08-21" + related_link: + type: "string" + example: "http://localhost:3000/news" + start_hour: + type: "string" + example: "16" + start_min: + type: "string" + example: "31" + start_ymd: + type: "string" + example: "2019-08-20" + type: + type: "string" + example: "info" + use_timer: + type: "string" + example: "true" + put: + summary: "Update Global Banner setting" + description: | + Update Global Banner setting as JSON format stored in a settings table. + + Only Redmine Administrator or user assigned to group named **"GlobalBanner_Admin"** can use this api. + The way to authenticate follows Redmine itself. + - Exp. User parameter ?key=YOUR_API_KEY or HTTP Header: X-Redmine-API-Key and so on. + - Please see: http://www.redmine.org/projects/redmine/wiki/Rest_api#Authentication + consumes: + - application/json + parameters: + - name: "X-Redmine-API-Key" + in: "header" + description: "Your API KEY" + required: true + type: "string" + - in: body + name: global_banner + description: Data to update Global Banner. + schema: + type: object + required: + - banner_description + - display_part + - type + properties: + banner_description: + type: string + example: "Message for Global Banner" + display_part: + type: "string" + example: "both" + enable: + type: "string" + example: "true" + end_hour: + type: "string" + example: "16" + end_min: + type: "string" + example: "31" + end_ymd: + type: "string" + example: "2019-08-21" + related_link: + type: "string" + example: "http://localhost:3000/news" + start_hour: + type: "string" + example: "16" + start_min: + type: "string" + example: "31" + start_ymd: + type: "string" + example: "2019-08-20" + type: + type: "string" + example: "info" + use_timer: + type: "string" + example: "true" + responses: + 200: + description: "Response in success." + schema: + type: "object" + properties: + status: + type: "string" + example: "OK" + message: + type: "string" + example: "updatig the global banner" + + From 38caea2d068b75ac9be01e555d3aa9366a33f809 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Tue, 20 Aug 2019 18:16:02 +0900 Subject: [PATCH 19/27] Add response sample in fail. --- script/swagger.yml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/script/swagger.yml b/script/swagger.yml index 3e33c18..670e5c9 100644 --- a/script/swagger.yml +++ b/script/swagger.yml @@ -71,6 +71,17 @@ paths: use_timer: type: "string" example: "true" + 401: + description: "Response in Unauthorized." + schema: + type: "object" + properties: + status: + type: "string" + example: "401" + message: + type: "string" + example: "Unauthorized" put: summary: "Update Global Banner setting" description: | @@ -146,5 +157,26 @@ paths: message: type: "string" example: "updatig the global banner" - + 401: + description: "Response in Unauthorized." + schema: + type: "object" + properties: + status: + type: "string" + example: "401" + message: + type: "string" + example: "Unauthorized" + 500: + description: "Response in internal error." + schema: + type: "object" + properties: + status: + type: "string" + example: "500" + message: + type: "string" + example: "Internal Server Error" From 093dfa087e0293efb90a69037f3c1206c6971f8c Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 09:20:30 +0900 Subject: [PATCH 20/27] Add the way to run test. --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index ac266af..6bd0917 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,25 @@ $ docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) \ $ docker run -p 3000:3000 akiko/redmine_banner:latest ``` +### Run test + +Please see wercker.yml for more details. + +```bash +% cd REDMINE_ROOT_DIR +% cp plugins/redmine_banner/Gemfile.local plugins/redmine_banner/Gemfile +% bundle install --with test +% export RAILS_ENV=test +% bundle exec ruby -I"lib:test" -I plugins/redmine_banner/test plugins/ \ + redmine_banner/test/controller/global_banner_controller_test.rb +``` + +or + +```bash +% bundle exec rails redmine_banner:test +``` + ### Repository * From 7b5c1859bd26ca861c484669cbd5139304d7b9cf Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 09:21:29 +0900 Subject: [PATCH 21/27] Add parameter check via permit method. Also change request parameter / response body. --- .../banners/api/global_banner_controller.rb | 32 ++++++-- .../global_banner_controller_test.rb | 76 +++++++++++++++++++ 2 files changed, 103 insertions(+), 5 deletions(-) create mode 100644 test/controller/global_banner_controller_test.rb diff --git a/app/controllers/banners/api/global_banner_controller.rb b/app/controllers/banners/api/global_banner_controller.rb index 6f6003d..8a9536f 100644 --- a/app/controllers/banners/api/global_banner_controller.rb +++ b/app/controllers/banners/api/global_banner_controller.rb @@ -11,7 +11,13 @@ def show end def register_banner - global_banner_params = build_params + begin + global_banner_params = build_params + rescue ActionController::ParameterMissing, ActionController::UnpermittedParameters => e + logger.warn("Global Banner Update failed. Caused: #{e.message}") + response_bad_request(e.message) + return + end retval = Setting.send('plugin_redmine_banner=', global_banner_params.stringify_keys) @@ -27,16 +33,17 @@ def register_banner # TODO: Validation is required def build_params - JSON.parse(request.body.read) + valid_params(params) end def global_banner_json - Setting['plugin_redmine_banner'].to_json + data = Setting['plugin_redmine_banner'].to_json + { global_banner: data } end # 400 Bad Request - def response_bad_request - render status: 400, json: { status: 400, message: 'Bad Request' } + def response_bad_request(error_message) + render status: 400, json: { status: 400, message: 'Bad Request', reason: error_message } end # 401 Unauthorized @@ -57,8 +64,23 @@ def require_banner_admin def banner_admin?(user) banner_admin_group = Group.find_by_lastname('GlobalBanner_Admin') + return false if banner_admin_group.blank? + banner_admin_group.users.include?(user) end + + def valid_params(params) + params.require(:global_banner).permit( + :banner_description, + :display_part, + :enable, + :end_hour, :end_min, :end_ymd, + :related_link, + :start_hour, :start_min, :start_ymd, + :type, + :use_timer + ) + end end end end diff --git a/test/controller/global_banner_controller_test.rb b/test/controller/global_banner_controller_test.rb new file mode 100644 index 0000000..1912307 --- /dev/null +++ b/test/controller/global_banner_controller_test.rb @@ -0,0 +1,76 @@ +# frozen_string_literal: true + +require File.expand_path('../test_helper', __dir__) +class GlobalBannerControllerTest < Redmine::IntegrationTest + fixtures :users + + def setup + @user = User.find_by_login('admin') + + @banner_admin_group = Group.create(name: 'GlobalBanner_Admin') + @non_admin_user = User.find(2) + end + + def test_routing + assert_routing({ path: '/banners/api/global_banner', method: :get }, controller: 'banners/api/global_banner', action: 'show') + assert_routing({ path: '/banners/api/global_banner', method: :put }, controller: 'banners/api/global_banner', action: 'register_banner') + end + + # Case Admin + def test_get_global_banner_when_api_disable + Setting.rest_api_enabled = '0' + get '/banners/api/global_banner.json', headers: { 'X-Redmine-API-Key' => @user.api_key } + assert_response 403 + end + + def test_get_global_banner_when_api_enable + Setting.rest_api_enabled = '1' + get '/banners/api/global_banner.json', headers: { 'X-Redmine-API-Key' => @user.api_key } + assert_response :success + end + + # Case non-admin user (jsmith) + def test_get_global_banner_when_api_enable_and_non_banner_admin_group + Setting.rest_api_enabled = '1' + get '/banners/api/global_banner.json', headers: { 'X-Redmine-API-Key' => @non_admin_user.api_key } + assert_response 401 + end + + def test_get_global_banner_when_api_enable_and_banner_admin_group + Setting.rest_api_enabled = '1' + + @banner_admin_group.user_ids = [@non_admin_user.id] + @banner_admin_group.save! + + get '/banners/api/global_banner.json', headers: { 'X-Redmine-API-Key' => @non_admin_user.api_key } + assert_response :success + end + + def test_put_global_banner_when_api_enable_and_banner_admin_group_and_empty_data + Setting.rest_api_enabled = '1' + + @banner_admin_group.user_ids = [@non_admin_user.id] + @banner_admin_group.save! + + put '/banners/api/global_banner.json', params: { "global_banner": {} }, as: :json, + headers: { 'X-Redmine-API-Key' => @non_admin_user.api_key } + assert_response 400 + end + + def test_put_global_banner_when_api_enable_and_banner_admin_group_and_valid_data + Setting.rest_api_enabled = '1' + + @banner_admin_group.user_ids = [@non_admin_user.id] + @banner_admin_group.save! + + global_banner = { + "banner_description": 'Test message', + "display_part": 'both', + "enable": 'true' + } + + put '/banners/api/global_banner.json', params: { "global_banner": global_banner }, as: :json, + headers: { 'X-Redmine-API-Key' => @non_admin_user.api_key } + assert_response :success + end +end From 41987328e12416564383b83d96f5a96cbbd10930 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 09:21:42 +0900 Subject: [PATCH 22/27] Update swagger definition. --- script/swagger.yml | 151 +++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 80 deletions(-) diff --git a/script/swagger.yml b/script/swagger.yml index 670e5c9..5767f4a 100644 --- a/script/swagger.yml +++ b/script/swagger.yml @@ -33,44 +33,7 @@ paths: 200: description: "Response in success" schema: - type: "object" - properties: - banner_description: - type: "string" - example: "This is a sample message." - display_part: - type: "string" - example: "both" - enable: - type: "string" - example: "true" - end_hour: - type: "string" - example: "16" - end_min: - type: "string" - example: "31" - end_ymd: - type: "string" - example: "2019-08-21" - related_link: - type: "string" - example: "http://localhost:3000/news" - start_hour: - type: "string" - example: "16" - start_min: - type: "string" - example: "31" - start_ymd: - type: "string" - example: "2019-08-20" - type: - type: "string" - example: "info" - use_timer: - type: "string" - example: "true" + $ref: '#/definitions/global_banner_body' 401: description: "Response in Unauthorized." schema: @@ -102,49 +65,9 @@ paths: - in: body name: global_banner description: Data to update Global Banner. + required: true schema: - type: object - required: - - banner_description - - display_part - - type - properties: - banner_description: - type: string - example: "Message for Global Banner" - display_part: - type: "string" - example: "both" - enable: - type: "string" - example: "true" - end_hour: - type: "string" - example: "16" - end_min: - type: "string" - example: "31" - end_ymd: - type: "string" - example: "2019-08-21" - related_link: - type: "string" - example: "http://localhost:3000/news" - start_hour: - type: "string" - example: "16" - start_min: - type: "string" - example: "31" - start_ymd: - type: "string" - example: "2019-08-20" - type: - type: "string" - example: "info" - use_timer: - type: "string" - example: "true" + $ref: '#/definitions/global_banner_body' responses: 200: description: "Response in success." @@ -180,3 +103,71 @@ paths: type: "string" example: "Internal Server Error" +definitions: + global_banner_body: + type: "object" + properties: + global_banner: + $ref: "#/definitions/Globel_banner" # Storeを呼び出す + Globel_banner: + type: "object" + required: + - banner_description + - display_part + - type + properties: + banner_description: + type: string + example: "Message for Global Banner" + display_part: + type: "string" + example: "both" + enum: [header, footer, both] + description: > + Display part: + * `header` - Display banner on the top + * `footer` - Display banner on the bottom + * `both` - Display banner both header and footer + enable: + type: "string" + example: "true" + enum: [true, false] + end_hour: + type: integer + example: 16 + maximum: 23 + end_min: + type: integer + example: 31 + maximum: 59 + end_ymd: + type: "string" + example: "2019-08-21" + related_link: + type: "string" + example: "http://localhost:3000/news" + start_hour: + type: integer + example: 16 + maximum: 23 + start_min: + type: integer + example: 31 + maximum: 59 + start_ymd: + type: "string" + example: "2019-08-20" + type: + type: "string" + example: "info" + enum: [info, warn, alert, normal, nodata] + description: > + type: + * `info` - Info style. (Pale blue) + * `warn` - Warning style. (Yellow) + * `alert` - Alert style. (Pale red) + * `normal` - White and without status icon. + * `nodata` - Redmine's style. + use_timer: + type: "string" + From a287bf2a6ee8619e9e983fe8eac2890f84da1b67 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 09:24:52 +0900 Subject: [PATCH 23/27] Change banner admin's group name to const. --- app/controllers/banners/api/global_banner_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/banners/api/global_banner_controller.rb b/app/controllers/banners/api/global_banner_controller.rb index 8a9536f..6ef62b3 100644 --- a/app/controllers/banners/api/global_banner_controller.rb +++ b/app/controllers/banners/api/global_banner_controller.rb @@ -3,6 +3,9 @@ module Banners module Api class GlobalBannerController < ApplicationController + # TODO: This group should be customize. + GLOBAL_BANNER_ADMIN_GROUP = 'GlobalBanner_Admin' + before_action :require_login, :require_banner_admin accept_api_auth :show, :register_banner @@ -63,7 +66,7 @@ def require_banner_admin end def banner_admin?(user) - banner_admin_group = Group.find_by_lastname('GlobalBanner_Admin') + banner_admin_group = Group.find_by_lastname(GLOBAL_BANNER_ADMIN_GROUP) return false if banner_admin_group.blank? banner_admin_group.users.include?(user) From 2ac9b67bb8d85a6e9114a578ab1321c1d6df218c Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 09:44:57 +0900 Subject: [PATCH 24/27] Modify error handling message. --- .../banners/api/global_banner_controller.rb | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/app/controllers/banners/api/global_banner_controller.rb b/app/controllers/banners/api/global_banner_controller.rb index 6ef62b3..7fc34e2 100644 --- a/app/controllers/banners/api/global_banner_controller.rb +++ b/app/controllers/banners/api/global_banner_controller.rb @@ -17,9 +17,7 @@ def register_banner begin global_banner_params = build_params rescue ActionController::ParameterMissing, ActionController::UnpermittedParameters => e - logger.warn("Global Banner Update failed. Caused: #{e.message}") - response_bad_request(e.message) - return + response_bad_request(e.message) && (return) end retval = Setting.send('plugin_redmine_banner=', global_banner_params.stringify_keys) @@ -27,13 +25,15 @@ def register_banner if retval render status: 200, json: { status: 'OK', message: 'updatig the global banner' } else - render status: 400, json: { status: 400, message: 'Bad Request' } + response_bad_request("Can't save data to settings table.") end rescue StandardError => e - logger.warn("Global Banner Update failed. Caused: #{e.message}") - response_internal_server_error + response_internal_server_error(e.message) end + private + + # TODO: Private methods should be refactoring. # TODO: Validation is required def build_params valid_params(params) @@ -45,8 +45,11 @@ def global_banner_json end # 400 Bad Request - def response_bad_request(error_message) - render status: 400, json: { status: 400, message: 'Bad Request', reason: error_message } + def response_bad_request(error_message = nil) + json_data = { status: 400, message: 'Bad Request' } + json_data.merge!(reason: error_message) if error_message.present? + logger.warn("Global Banner Update failed. Caused: #{json_data}") + render status: 400, json: json_data end # 401 Unauthorized @@ -55,8 +58,11 @@ def response_unauthorized end # 500 Internal Server Error - def response_internal_server_error - render status: 500, json: { status: 500, message: 'Internal Server Error' } + def response_internal_server_error(error_message = nil) + json_data = { status: 500, message: 'Internal Server Error' } + json_data.merge!(reason: error_message) if error_message.present? + logger.warn("Global Banner Update failed. Caused: #{json_data}") + render status: 500, json: json_data end def require_banner_admin From 89fe65fa30025496fcb9b550c8250b3fc2907730 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 15:34:17 +0900 Subject: [PATCH 25/27] Fix response and build steps. (#114) * Change workdir to app, enabled to run container on Heroku correctly. * Prevent escape string. * Update CircleCI setting. * Add step to deploy heroku. --- .circleci/config.yml | 34 +++++++++++ Dockerfile | 12 ++-- .../banners/api/global_banner_controller.rb | 5 +- redmine_banner_docker/Dockerfile | 57 +++++++++++++++++++ 4 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 redmine_banner_docker/Dockerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index 7972889..17ef4d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -58,6 +58,28 @@ jobs: cp -r coverage/${CIRCLE_PROJECT_REPONAME}_test /tmp/coverage/ - store_artifacts: path: /tmp/coverage + deploy_heroku: + machine: + image: circleci/classic:edge + steps: + - checkout + - run: + name: 'Install Heroku CLI, if necessary' + command: | + curl https://cli-assets.heroku.com/install.sh | sh + - run: + name: 'Build Docker Image' + command: | + heroku -v + docker build --build-arg=COMMIT=${CIRCLE_SHA1} \ + --build-arg=BRANCH=${CIRCLE_BRANCH} -t registry.heroku.com/${HEROKU_APP_NAME}/web . + - run: + name: 'Release Docker Image' + command: | + docker login --username=_ --password=$HEROKU_AUTH_TOKEN registry.heroku.com + docker push registry.heroku.com/${HEROKU_APP_NAME}/web + #heroku container:push web --app ${HEROKU_APP_NAME} + heroku container:release web --app ${HEROKU_APP_NAME} workflows: build_test_push: @@ -86,5 +108,17 @@ workflows: extra-build-args: '--build-arg COMMIT=$CIRCLE_SHA1 --build-arg=BRANCH=$CIRCLE_BRANCH' requires: - test + filters: + branches: + only: + - master + - deploy_heroku: + requires: + - build + filters: + branches: + ignore: + - dev + - master diff --git a/Dockerfile b/Dockerfile index 190c329..00699fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ ARG COMMIT="commit_sha" ENV COMMIT_SHA=${COMMIT} ENV COMMIT_BRANCH=${BRANCH} +RUN mkdir /app ### get Redmine source ### Replace shell with bash so we can source files ### @@ -25,19 +26,19 @@ RUN apt-get install -qq -y --no-install-recommends \ git vim subversion \ sqlite3 && rm -rf /var/lib/apt/lists/* -RUN cd /tmp && svn co http://svn.redmine.org/redmine/branches/4.0-stable/ redmine -WORKDIR /tmp/redmine +RUN cd /app && svn co http://svn.redmine.org/redmine/branches/4.0-stable/ redmine +WORKDIR /app/redmine -COPY . /tmp/redmine/plugins/redmine_banner/ +COPY . /app/redmine/plugins/redmine_banner/ # add database.yml (for development, development with mysql, test) RUN echo $'test:\n\ adapter: sqlite3\n\ - database: /tmp/data/redmine_test.sqlite3\n\ + database: /app/data/redmine_test.sqlite3\n\ encoding: utf8mb4\n\ development:\n\ adapter: sqlite3\n\ - database: /tmp/data/redmine_development.sqlite3\n\ + database: /app/data/redmine_development.sqlite3\n\ encoding: utf8mb4\n'\ >> config/database.yml @@ -54,4 +55,5 @@ RUN bundle exec rails runner \ "User.find_by_login('admin').update!(password: 'redmine_banner_${COMMIT_SHA}', must_change_passwd: false)" EXPOSE 3000 +RUN ls /app/redmine CMD ["rails", "server", "-b", "0.0.0.0"] diff --git a/app/controllers/banners/api/global_banner_controller.rb b/app/controllers/banners/api/global_banner_controller.rb index 7fc34e2..c6bf9dc 100644 --- a/app/controllers/banners/api/global_banner_controller.rb +++ b/app/controllers/banners/api/global_banner_controller.rb @@ -23,7 +23,7 @@ def register_banner retval = Setting.send('plugin_redmine_banner=', global_banner_params.stringify_keys) if retval - render status: 200, json: { status: 'OK', message: 'updatig the global banner' } + render status: 200, json: { status: 'OK', message: 'updating the global banner' } else response_bad_request("Can't save data to settings table.") end @@ -40,8 +40,7 @@ def build_params end def global_banner_json - data = Setting['plugin_redmine_banner'].to_json - { global_banner: data } + { global_banner: Setting['plugin_redmine_banner'] } end # 400 Bad Request diff --git a/redmine_banner_docker/Dockerfile b/redmine_banner_docker/Dockerfile new file mode 100644 index 0000000..190c329 --- /dev/null +++ b/redmine_banner_docker/Dockerfile @@ -0,0 +1,57 @@ +# +# docker build --build-arg=COMMIT=$(git rev-parse --short HEAD) \ +# --build-arg=BRANCH=$(git name-rev --name-only HEAD) -t akiko/redmine_banner:latest . +# +# +FROM ruby:2.5 +LABEL maintainer="AKIKO TAKANO / (Twitter: @akiko_pusu)" \ + description="Image to run Redmine simply with sqlite to try/review plugin." + +ARG BRANCH="master" +ARG COMMIT="commit_sha" + +ENV COMMIT_SHA=${COMMIT} +ENV COMMIT_BRANCH=${BRANCH} + + +### get Redmine source +### Replace shell with bash so we can source files ### +RUN rm /bin/sh && ln -s /bin/bash /bin/sh + +### install default sys packeges ### + +RUN apt-get update +RUN apt-get install -qq -y --no-install-recommends \ + git vim subversion \ + sqlite3 && rm -rf /var/lib/apt/lists/* + +RUN cd /tmp && svn co http://svn.redmine.org/redmine/branches/4.0-stable/ redmine +WORKDIR /tmp/redmine + +COPY . /tmp/redmine/plugins/redmine_banner/ + +# add database.yml (for development, development with mysql, test) +RUN echo $'test:\n\ + adapter: sqlite3\n\ + database: /tmp/data/redmine_test.sqlite3\n\ + encoding: utf8mb4\n\ +development:\n\ + adapter: sqlite3\n\ + database: /tmp/data/redmine_development.sqlite3\n\ + encoding: utf8mb4\n'\ +>> config/database.yml + +RUN gem update bundler +RUN bundle install --without postgresql rmagick mysql +RUN bundle exec rake db:migrate && bundle exec rake redmine:plugins:migrate \ + && bundle exec rake generate_secret_token +RUN bundle exec rails runner \ + "Setting.send('plugin_redmine_banner=', {enable: 'true', type: 'info', display_part: 'both', banner_description: 'This is a test message for Global Banner. (${COMMIT_BRANCH}:${COMMIT_SHA})'}.stringify_keys)" + +# Change Admin's password to 'redmine_banner_${COMMIT_SHA}' +# Default is 'redmine_banner_commit_sha' +RUN bundle exec rails runner \ + "User.find_by_login('admin').update!(password: 'redmine_banner_${COMMIT_SHA}', must_change_passwd: false)" + +EXPOSE 3000 +CMD ["rails", "server", "-b", "0.0.0.0"] From 2af5b42b4389bdf08889ec2166e2061b76bf3168 Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 15:54:38 +0900 Subject: [PATCH 26/27] Change test container release to haroku at dev branch. --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 17ef4d2..fe106e9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -118,7 +118,6 @@ workflows: filters: branches: ignore: - - dev - master From eb945a694f3cee29a68568cbbdb09384ed33072b Mon Sep 17 00:00:00 2001 From: Akiko Takano Date: Wed, 21 Aug 2019 15:54:52 +0900 Subject: [PATCH 27/27] Update version to 0.2.1. --- README.md | 13 +++++++++++++ init.rb | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6bd0917..6b84ade 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,19 @@ Please use ver **0.1.x** or ``v0.1.x-support-Redmine3`` branch in case using Red ## Changelog +### 0.2.1 + +* Fix: Prevent conflict with CKEditor. (GitHub: #111) +* Code refactoring. +* Add feature to update Global Banner via API. (Alpha / Related: #86 #113) + * Not only Redmine admin but also user who assigned group named **GlobalBanner_Admin** can also update Global banner via API. + * Even prptotype version. + * Please see [swagger.yml](script/swagger.yml) to try update global banner via API. +* Update CI Setting + * Add step to build and push image to AWS ECR. + * Add steps to build and deploy to Heroku Container registry as release container service. +* Add how to try banner via Docker in README. + ### 0.2.0 * Support Redmine 4.x. diff --git a/init.rb b/init.rb index 79ec564..579e832 100644 --- a/init.rb +++ b/init.rb @@ -21,7 +21,7 @@ def banner_version_message(original_message = nil) author 'Akiko Takano' author_url 'http://twitter.com/akiko_pusu' description 'Plugin to show site-wide message, such as maintenacne informations or notifications.' - version '0.2.0' + version '0.2.1' requires_redmine version_or_higher: '4.0' url 'https://github.com/akiko-pusu/redmine_banner'