Skip to content

Commit

Permalink
restructure to patch + shell scripts executed by a generic wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
j-bauer committed Apr 6, 2023
1 parent 7cee18d commit b93bc7c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
ARG VERSION=latest
FROM gitlab/gitlab-ee:$VERSION

# re-set VERSION as its cleared after a FROM directive
ARG VERSION
COPY patches/${VERSION} /patches
RUN set -e; for p in /patches/*; do patch -p0 < $p; done

# copy static files
COPY templates/arc.tar.gz /opt/gitlab/embedded/service/gitlab-rails/vendor/project_templates/
COPY assets/dataplant-arc.png assets/house-solid.svg /opt/gitlab/embedded/service/gitlab-rails/public/assets/

#COPY pages.projects.new.5b691961.chunk.js.gz /opt/gitlab/embedded/service/gitlab-rails/public/assets/webpack/
#COPY pages.projects.new.5b691961.chunk.js.map.gz /opt/gitlab/embedded/service/gitlab-rails/public/assets/webpack/
# copy and execute the patch scripts
COPY scripts/${VERSION} /scripts
RUN /scripts/patch.sh

11 changes: 11 additions & 0 deletions scripts/15.10.1-ee.0/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -ex

for patch in /scripts/patches/*.patch; do
patch -p0 < "$patch"
done

for script in /scripts/patches/*.sh; do
"$script"
done
File renamed without changes.
19 changes: 19 additions & 0 deletions scripts/15.10.1-ee.0/patches/add-arc-js.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

set -- /opt/gitlab/embedded/service/gitlab-rails/public/assets/webpack/pages.projects.imports.new.*.chunk.js

# exit if above's glob matches nothing or more than 1 file
[ -e "$1" ] && [ "$#" = "1" ]

# the mighty "patch"
sed -Ei.bak \
's/sample:(\{text:Object\([^)]+\))/arc:\1("ProjectTemplates|ARC"),icon:".template-option .icon-gitlab_logo"},&/' \
"$1"

# needs to be gzip'ed too
gzip -kf "$1"

# print diffs to see what was done
diff -u "$1" "${1}.bak" || true
File renamed without changes.
File renamed without changes.

0 comments on commit b93bc7c

Please sign in to comment.