support different (alpine) versions
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
and make it easier to add new distros too
This commit is contained in:
parent
5a52984b3d
commit
4759658774
4 changed files with 21 additions and 4 deletions
|
@ -19,6 +19,7 @@ RUN gem install --no-user-install --no-document --source https://rubygems.org ge
|
||||||
COPY ./gem-compiler.sh /usr/local/bin/gem-compiler
|
COPY ./gem-compiler.sh /usr/local/bin/gem-compiler
|
||||||
COPY ./bootstrap.sh /usr/local/bin/bootstrap
|
COPY ./bootstrap.sh /usr/local/bin/bootstrap
|
||||||
COPY ./bulk-compiler.sh /usr/local/bin/bulk-compiler
|
COPY ./bulk-compiler.sh /usr/local/bin/bulk-compiler
|
||||||
|
COPY ./os-version.sh /usr/local/bin/os-version
|
||||||
|
|
||||||
RUN install -dm 2750 -o builder -g builder /srv/gems
|
RUN install -dm 2750 -o builder -g builder /srv/gems
|
||||||
VOLUME /srv/gems
|
VOLUME /srv/gems
|
||||||
|
|
|
@ -6,12 +6,16 @@ test -n "${HTTP_BASIC_PASSWORD}"
|
||||||
test -n "${SUTTY}"
|
test -n "${SUTTY}"
|
||||||
test -n "${PLATFORM}"
|
test -n "${PLATFORM}"
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
|
||||||
|
OS_VERSION="$(os-version)"
|
||||||
|
|
||||||
install -dm 755 -o builder -g builder cache gems
|
install -dm 755 -o builder -g builder cache gems
|
||||||
|
|
||||||
echo "1..$(find build/ -type f | grep -v /.keep | wc -l)"
|
echo "1..$(find build/ -type f | grep -v /.keep | wc -l)"
|
||||||
|
|
||||||
find build/ -type f | grep -v /.keep | nl |
|
find build/ -type f | grep -v /.keep | nl |
|
||||||
sed -re "s|\tbuild/([^/]+)/(.*)|&\tbuilt/${ALPINE_VERSION}/\1/\2\tfailed/${ALPINE_VERSION}/\1/\2\t\1\t\2|" |
|
sed -re "s|\tbuild/([^/]+)/(.*)|&\tbuilt/${ID}/${OS_VERSION}/\1/\2\tfailed/${ID}/${OS_VERSION}/\1/\2\t\1\t\2|" |
|
||||||
while read NUMBER BUILD BUILT FAILED GEM_NAME GEM_VERSION; do
|
while read NUMBER BUILD BUILT FAILED GEM_NAME GEM_VERSION; do
|
||||||
if test -f "${BUILT}" ; then
|
if test -f "${BUILT}" ; then
|
||||||
echo "ok ${NUMBER} - ${GEM_NAME} ${GEM_VERSION} already built, skipping"
|
echo "ok ${NUMBER} - ${GEM_NAME} ${GEM_VERSION} already built, skipping"
|
||||||
|
|
|
@ -8,10 +8,17 @@ test -n "${HTTP_BASIC_PASSWORD}"
|
||||||
test -n "${SUTTY}"
|
test -n "${SUTTY}"
|
||||||
test -n "${PLATFORM}"
|
test -n "${PLATFORM}"
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
|
||||||
|
# 3.13.alpine.gems.sutty.nl
|
||||||
|
# rolling.arch.gems.sutty.nl
|
||||||
|
# 18.04.ubuntu.gems.sutty.nl
|
||||||
|
OS_VERSION="$(os-version)"
|
||||||
|
RUBY_GEMS="${OS_VERSION}.${ID}.gems.${SUTTY}"
|
||||||
|
|
||||||
cd cache/
|
cd cache/
|
||||||
# TODO: Support multiple Alpine/Ruby versions
|
gem fetch --source=https://${RUBY_GEMS} --platform=ruby --version ${GEM_VERSION} ${GEM_NAME}
|
||||||
gem fetch --source=https://gems.${SUTTY} --platform=ruby --version ${GEM_VERSION} ${GEM_NAME}
|
|
||||||
|
|
||||||
cd ../gems/
|
cd ../gems/
|
||||||
gem compile -V --prune --strip "strip --strip-unneeded" ${GEM_COMPILER_FLAGS} "../cache/${GEM_NAME}-${GEM_VERSION}.gem"
|
gem compile -V --prune --strip "strip --strip-unneeded" ${GEM_COMPILER_FLAGS} "../cache/${GEM_NAME}-${GEM_VERSION}.gem"
|
||||||
gem inabox -o "${GEM_NAME}-${GEM_VERSION}-${PLATFORM}.gem" --host https://${HTTP_BASIC_USER}:${HTTP_BASIC_PASSWORD}@gems.${SUTTY}
|
gem inabox -o "${GEM_NAME}-${GEM_VERSION}-${PLATFORM}.gem" --host https://${HTTP_BASIC_USER}:${HTTP_BASIC_PASSWORD}@${RUBY_GEMS}
|
||||||
|
|
5
os-version.sh
Executable file
5
os-version.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Return current version in DNS format
|
||||||
|
|
||||||
|
source /etc/os-release
|
||||||
|
echo "${BUILD_ID:-$(echo "${VERSION_ID}" | cut -d . -f 1-2 | sed -re "s/\./\n/" | tac | tr "\n" "." | sed -re "s/\.$//")}"
|
Loading…
Reference in a new issue