From ee7d1599e896f82accac69288edc6ff450a53c83 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Jan 2024 18:27:02 -0300 Subject: [PATCH 01/15] fix: limitar el nombre del archivo #14946 --- app/models/metadata_path.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/metadata_path.rb b/app/models/metadata_path.rb index 95fc7dbb..17085e07 100644 --- a/app/models/metadata_path.rb +++ b/app/models/metadata_path.rb @@ -6,7 +6,7 @@ class MetadataPath < MetadataTemplate # # @return [String] def default_value - File.join(site.path, "_#{lang}", "#{date}-#{slug}#{ext}") + File.join(site.path, "_#{lang}", "#{limited_name}#{ext}") end # La ruta del archivo según Jekyll @@ -46,4 +46,12 @@ class MetadataPath < MetadataTemplate def date post.date.value.strftime('%F') end + + # Limita el nombre de archivo a 255 bytes, de forma que siempre + # podemos guardarlo + # + # @return [String] + def limited_name + "#{date}-#{slug}".mb_chars.limit(255 - ext.length) + end end From c2534578400e416d5560ed1344e58a87d1cc6092 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 10 Jan 2024 11:39:07 -0300 Subject: [PATCH 02/15] fix: env para desarrollo --- .env.development | 1 + 1 file changed, 1 insertion(+) create mode 100644 .env.development diff --git a/.env.development b/.env.development new file mode 100644 index 00000000..df2788b0 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +HAINISH=../haini.sh/haini.sh From 5aef69cd940e05cadc365bed4af835cd7e82a78e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 16:52:24 -0300 Subject: [PATCH 03/15] fix: eliminar los guiones bajos al principio del nombre de archivo #14953 porque jekyll los toma como archivos ocultos --- .../active_storage/direct_uploads_controller_decorator.rb | 2 +- app/lib/action_dispatch/http/uploaded_file_decorator.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/active_storage/direct_uploads_controller_decorator.rb b/app/controllers/active_storage/direct_uploads_controller_decorator.rb index c62dae2a..5ac58ecf 100644 --- a/app/controllers/active_storage/direct_uploads_controller_decorator.rb +++ b/app/controllers/active_storage/direct_uploads_controller_decorator.rb @@ -19,7 +19,7 @@ module ActiveStorage # stack. def blob_args params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys.tap do |ba| - ba[:filename] = ba[:filename].unicode_normalize + ba[:filename] = ba[:filename].unicode_normalize.sub(/\A_+/, '') end end end diff --git a/app/lib/action_dispatch/http/uploaded_file_decorator.rb b/app/lib/action_dispatch/http/uploaded_file_decorator.rb index 0bdebdc0..7b28a0db 100644 --- a/app/lib/action_dispatch/http/uploaded_file_decorator.rb +++ b/app/lib/action_dispatch/http/uploaded_file_decorator.rb @@ -11,7 +11,7 @@ module ActionDispatch # Devolver el nombre de archivo con caracteres unicode # normalizados def original_filename - @original_filename.unicode_normalize + @original_filename.unicode_normalize.sub(/\A_+/, '') end end end From 76644700d164060079c125148b6a7f62d50ca4ba Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:03:37 -0300 Subject: [PATCH 04/15] fix: traer la lista de archivos modificados --- bin/modified_files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/modified_files b/bin/modified_files index 37bcabeb..d26e71f3 100755 --- a/bin/modified_files +++ b/bin/modified_files @@ -3,6 +3,6 @@ set -e test -n "${CI_MERGE_REQUEST_DIFF_BASE_SHA}" -git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA}...origin/rails \ +git diff --name-status ${CI_MERGE_REQUEST_DIFF_BASE_SHA} \ | grep -v "^D" \ | cut -f 2 From 9c97e0f87c3c618083444d75af4f5b8021d2a16c Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:08:05 -0300 Subject: [PATCH 05/15] =?UTF-8?q?ci:=20por=20qu=C3=A9=20faltan=20las=20gem?= =?UTF-8?q?as=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38f480c9..39d7787f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,6 +81,7 @@ rubocop: before_script: - *apk-add - *disable-hainish + - ls -hal vendor/ruby script: - "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop" haml: From a78d02d84af8fb4bc9db2e23a7b18a2bb5ef2dee Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:10:55 -0300 Subject: [PATCH 06/15] =?UTF-8?q?fixup!=20ci:=20por=20qu=C3=A9=20faltan=20?= =?UTF-8?q?las=20gemas=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39d7787f..aa3677f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -81,6 +81,9 @@ rubocop: before_script: - *apk-add - *disable-hainish + - env + - ls -hal vendor + - ls -hal vendor - ls -hal vendor/ruby script: - "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop" From 1ede2af465114a80c776e116d40a537f851334f7 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:36 -0300 Subject: [PATCH 07/15] fix: instalar dependencias --- Taskfile.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 8427db4a..c2d72472 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -24,11 +24,14 @@ tasks: deps: - "credentials" cmds: - - task: "bundle" + - "{{.HAINISH}} bundle config set --local path './vendor'" + - "{{.HAINISH}} bundle install" sources: - "Gemfile" generates: - "Gemfile.lock" + status: + - "test -d vendor/ruby" clean: desc: "Clean" cmds: From 24120bfd904101e42e722ef9dc456da03e129a81 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:58 -0300 Subject: [PATCH 08/15] =?UTF-8?q?fix:=20agregar=20configuraci=C3=B3n=20de?= =?UTF-8?q?=20bundler=20a=20la=20cach=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aa3677f2..0e38e7d6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ .cache-ruby: &cache-ruby - paths: - "vendor/ruby" + - ".bundle" .cache-node: &cache-node - paths: - "node_modules" From 987e19f565e7e85ae68836ddb552a83d315e1e51 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:24:51 -0300 Subject: [PATCH 09/15] =?UTF-8?q?fixup!=20fixup!=20ci:=20por=20qu=C3=A9=20?= =?UTF-8?q?faltan=20las=20gemas=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e38e7d6..e4cee087 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ .apk-add: &apk-add -- "apk add go-task diffutils" +- "apk add go-task diffutils gitlab_ci_log_section" .disable-hainish: &disable-hainish - "rm -f .env.development" .cache-ruby: &cache-ruby @@ -27,13 +27,18 @@ assets: - *cache-node - *cache-task before_script: + - "gitlab_ci_log_section --name git --header=\"Configuring git\"" - "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\"" - "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\"" - "git remote set-url --push origin \"https://${GITLAB_USERNAME}:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"" + - "gitlab_ci_log_section --name git --end" + - "gitlab_ci_log_section --name apk --header=\"Installing dependencies\"" - "apk add brotli" - *apk-add - *disable-hainish + - "gitlab_ci_log_section --name apk --end" script: + - "gitlab_ci_log_section --name assets --header=\"Building\"" - "go-task assets" after_script: - "git add public && git commit -m \"ci: assets [skip ci]\"" @@ -82,10 +87,6 @@ rubocop: before_script: - *apk-add - *disable-hainish - - env - - ls -hal vendor - - ls -hal vendor - - ls -hal vendor/ruby script: - "./bin/modified_files | ./bin/with_extension rb | xargs -r go-task bundle -- exec rubocop" haml: From 7f3d87b3177f3f87b3b4bc484be3ffec751b7edc Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:29:32 -0300 Subject: [PATCH 10/15] chore: rubocop --- .../active_storage/direct_uploads_controller_decorator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/active_storage/direct_uploads_controller_decorator.rb b/app/controllers/active_storage/direct_uploads_controller_decorator.rb index 5ac58ecf..94070882 100644 --- a/app/controllers/active_storage/direct_uploads_controller_decorator.rb +++ b/app/controllers/active_storage/direct_uploads_controller_decorator.rb @@ -18,7 +18,8 @@ module ActiveStorage # para que puedan propagarse correctamente a través de todo el # stack. def blob_args - params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys.tap do |ba| + params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, + metadata: {}).to_h.symbolize_keys.tap do |ba| ba[:filename] = ba[:filename].unicode_normalize.sub(/\A_+/, '') end end From 1fbfd30017079bafaff19021b32d8587f95fa116 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:36 -0300 Subject: [PATCH 11/15] fix: instalar dependencias --- Taskfile.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 8427db4a..c2d72472 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -24,11 +24,14 @@ tasks: deps: - "credentials" cmds: - - task: "bundle" + - "{{.HAINISH}} bundle config set --local path './vendor'" + - "{{.HAINISH}} bundle install" sources: - "Gemfile" generates: - "Gemfile.lock" + status: + - "test -d vendor/ruby" clean: desc: "Clean" cmds: From 7e43d8f3326bc91e87b224a4b2eea51058ef4694 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:18:58 -0300 Subject: [PATCH 12/15] =?UTF-8?q?fix:=20agregar=20configuraci=C3=B3n=20de?= =?UTF-8?q?=20bundler=20a=20la=20cach=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38f480c9..fd67b54a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ .cache-ruby: &cache-ruby - paths: - "vendor/ruby" + - ".bundle" .cache-node: &cache-node - paths: - "node_modules" From 6ec99072736dae32e8aef1f068e78e0ea2fbc254 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jan 2024 17:29:32 -0300 Subject: [PATCH 13/15] chore: rubocop --- .../active_storage/direct_uploads_controller_decorator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/active_storage/direct_uploads_controller_decorator.rb b/app/controllers/active_storage/direct_uploads_controller_decorator.rb index 5ac58ecf..94070882 100644 --- a/app/controllers/active_storage/direct_uploads_controller_decorator.rb +++ b/app/controllers/active_storage/direct_uploads_controller_decorator.rb @@ -18,7 +18,8 @@ module ActiveStorage # para que puedan propagarse correctamente a través de todo el # stack. def blob_args - params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, metadata: {}).to_h.symbolize_keys.tap do |ba| + params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, + metadata: {}).to_h.symbolize_keys.tap do |ba| ba[:filename] = ba[:filename].unicode_normalize.sub(/\A_+/, '') end end From 6c3b2ab022b50bb15753d5acdd584f76239142d3 Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 1 Mar 2024 12:19:51 -0300 Subject: [PATCH 14/15] fix: movido metodo lfs_cleanup en cleanup_service.rb a site::repository --- app/models/site/repository.rb | 5 +++++ app/services/cleanup_service.rb | 10 ++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index acbf6553..58baa5dd 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -235,5 +235,10 @@ class Site r&.success? end + + def lfs_cleanup + site.repository.git_sh("git", "lfs", "prune") + site.repository.git_sh("git", "lfs", "dedup") + end end end diff --git a/app/services/cleanup_service.rb b/app/services/cleanup_service.rb index 28f6f860..e53fbcb4 100644 --- a/app/services/cleanup_service.rb +++ b/app/services/cleanup_service.rb @@ -31,7 +31,7 @@ class CleanupService site.deploys.find_each(&:cleanup!) site.repository.gc - lfs_cleanup + site.repository.lfs_cleanup site.touch end end @@ -46,14 +46,8 @@ class CleanupService Rails.logger.info "Limpiando repositorio git de #{site.name}" site.repository.gc - lfs_cleanup + site.repository.lfs_cleanup site.touch end end - - private - def lfs_cleanup - site.repository.git_sh("git", "lfs", "prune") - site.repository.git_sh("git", "lfs", "dedup") - end end From 291c477aec286e4cbefca321604c91cdf428c65a Mon Sep 17 00:00:00 2001 From: jazzari Date: Fri, 1 Mar 2024 13:11:04 -0300 Subject: [PATCH 15/15] fix: corregido metodo lfs_cleanup --- app/models/site/repository.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/site/repository.rb b/app/models/site/repository.rb index 58baa5dd..687ced12 100644 --- a/app/models/site/repository.rb +++ b/app/models/site/repository.rb @@ -237,8 +237,8 @@ class Site end def lfs_cleanup - site.repository.git_sh("git", "lfs", "prune") - site.repository.git_sh("git", "lfs", "dedup") + git_sh("git", "lfs", "prune") + git_sh("git", "lfs", "dedup") end end end