th: streaming builds again?
This commit is contained in:
parent
8fd45df06e
commit
f50b12fe6e
3 changed files with 41 additions and 55 deletions
|
@ -1,6 +1,7 @@
|
|||
variables:
|
||||
environment: &docker-environment
|
||||
NAME: gitea.treehouse.systems/treehouse/mastodon
|
||||
SERVER_IMAGE: gitea.treehouse.systems/treehouse/mastodon
|
||||
STREAMING_IMAGE: gitea.treehouse.systems/treehouse/mastodon-streaming
|
||||
DATE_COMMAND: export COMMIT_DATE=$(date -u -Idate -d @$(git show -s --format=%ct))
|
||||
docker-step: &docker-step
|
||||
image: docker:rc-git
|
||||
|
@ -17,43 +18,18 @@ clone:
|
|||
depth: 10
|
||||
|
||||
pipeline:
|
||||
# build-base:
|
||||
# <<: *docker-step
|
||||
# commands:
|
||||
# - docker version
|
||||
# - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target build-base -t $NAME:build-base
|
||||
|
||||
# build:
|
||||
# <<: *docker-step
|
||||
# commands:
|
||||
# - docker version
|
||||
# - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target build -t $NAME:build
|
||||
|
||||
# output-base:
|
||||
# <<: *docker-step
|
||||
# commands:
|
||||
# - docker version
|
||||
# - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . --target output-base -t $NAME:build
|
||||
|
||||
# the world is not yet ready for this step
|
||||
# test:
|
||||
# <<: *docker-step
|
||||
# commands:
|
||||
# - docker run --rm -e RAILS_ENV=test -e NODE_ENV=development $NAME:build-base sh -c 'bundle config set --local without development && bundle install && rake spec'
|
||||
|
||||
output:
|
||||
<<: *docker-step
|
||||
commands:
|
||||
- eval $DATE_COMMAND
|
||||
- export TAG=$${COMMIT_DATE}.$CI_COMMIT_SHA && echo $${TAG}
|
||||
- docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME:latest
|
||||
- docker image build -f streaming/Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME-streaming:latest
|
||||
- docker tag $NAME:latest $NAME:$TAG
|
||||
- docker tag $NAME-streaming:latest $NAME-streaming:$TAG
|
||||
# idk what's actually persisted between steps
|
||||
# /shrug this works, so,???
|
||||
- echo $${TAG} > tags.txt
|
||||
- echo latest >> tags.txt
|
||||
- docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $SERVER_IMAGE:$${TAG}
|
||||
- docker image build -f streaming/Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $STREAMING_IMAGE:$${TAG}
|
||||
- docker tag $SERVER_IMAGE:$${TAG} $SERVER_IMAGE:latest
|
||||
- docker tag $STREAMING_IMAGE:$${TAG} $SERVER_IMAGE:latest
|
||||
- echo -n > tags.txt
|
||||
- echo $${TAG} | tee -a tags.txt
|
||||
- echo latest | tee -a tags.txt
|
||||
|
||||
# maybe we can use tags someday,,,
|
||||
# tag-tag:
|
||||
|
@ -61,7 +37,7 @@ pipeline:
|
|||
# volumes:
|
||||
# - /var/run/docker.sock:/var/run/docker.sock
|
||||
# commands:
|
||||
# - docker tag $NAME:latest $NAME:$CI_COMMIT_TAG
|
||||
# - docker tag $SERVER_IMAGE:latest $SERVER_IMAGE:$CI_COMMIT_TAG
|
||||
# when:
|
||||
# event: tag
|
||||
|
||||
|
@ -69,10 +45,10 @@ pipeline:
|
|||
<<: *docker-step
|
||||
commands:
|
||||
- echo $REGISTRY_SECRET | docker login -u $REGISTRY_USER --password-stdin gitea.treehouse.systems
|
||||
- cat tags.txt | xargs -n 1 -I% echo docker image push $NAME:%
|
||||
- cat tags.txt | xargs -n 1 -I% docker image push $NAME:%
|
||||
- cat tags.txt | xargs -n 1 -I% echo docker image push $NAME-streaming:%
|
||||
- cat tags.txt | xargs -n 1 -I% docker image push $NAME-streaming:%
|
||||
- cat tags.txt | xargs -n 1 -I% echo docker image push $SERVER_IMAGE:%
|
||||
- cat tags.txt | xargs -n 1 -I% docker image push $SERVER_IMAGE:%
|
||||
- cat tags.txt | xargs -n 1 -I% echo docker image push $STREAMING_IMAGE:%
|
||||
- cat tags.txt | xargs -n 1 -I% docker image push $STREAMING_IMAGE:%
|
||||
when:
|
||||
event: [push, tag]
|
||||
branch: main
|
||||
|
|
|
@ -26,6 +26,8 @@ ARG MASTODON_VERSION_PRERELEASE=""
|
|||
# Append build metadata or fork information to version.rb [--build-arg MASTODON_VERSION_METADATA="something"]
|
||||
ARG MASTODON_VERSION_METADATA=""
|
||||
|
||||
ARG SOURCE_TAG=""
|
||||
|
||||
# Allow Ruby on Rails to serve static files
|
||||
# See: https://docs.joinmastodon.org/admin/config/#rails_serve_static_files
|
||||
ARG RAILS_SERVE_STATIC_FILES="true"
|
||||
|
|
|
@ -44,33 +44,41 @@ module Mastodon
|
|||
end
|
||||
|
||||
def repository
|
||||
ENV.fetch('GIT_REPOSITORY', false) || ENV.fetch('GITHUB_REPOSITORY', false) || 'treehouse/mastodon'
|
||||
@repository ||= ENV.fetch('GIT_REPOSITORY', false) || ENV.fetch('GITHUB_REPOSITORY', false) || 'treehouse/mastodon'
|
||||
end
|
||||
|
||||
def source_base_url
|
||||
base = ENV['GITHUB_REPOSITORY'] ? 'https://github.com' : 'https://gitea.treehouse.systems'
|
||||
ENV.fetch('SOURCE_BASE_URL', "#{base}/#{repository}")
|
||||
@source_base_url ||=
|
||||
begin
|
||||
base = ENV['GITHUB_REPOSITORY'] ? 'https://github.com' : 'https://gitea.treehouse.systems'
|
||||
ENV.fetch('SOURCE_BASE_URL', "#{base}/#{repository}")
|
||||
end
|
||||
end
|
||||
|
||||
# specify git tag or commit hash here
|
||||
def source_tag
|
||||
tag = ENV.fetch('SOURCE_TAG', nil)
|
||||
return if tag.nil? || tag.empty?
|
||||
tag
|
||||
@source_tag ||=
|
||||
begin
|
||||
tag = ENV.fetch('SOURCE_TAG', nil)
|
||||
return if tag.nil? || tag.empty?
|
||||
tag
|
||||
end
|
||||
end
|
||||
|
||||
def source_url
|
||||
tag = source_tag
|
||||
if tag && source_base_url =~ /gitea/
|
||||
suffix = if !tag[/\H/]
|
||||
"commit/#{tag}"
|
||||
else
|
||||
"branch/#{tag}"
|
||||
end
|
||||
"#{source_base_url}/#{suffix}"
|
||||
else
|
||||
source_base_url
|
||||
end
|
||||
@source_url ||=
|
||||
begin
|
||||
if source_tag && source_base_url =~ /gitea/
|
||||
suffix = if !tag[/\H/]
|
||||
"commit/#{source_tag}"
|
||||
else
|
||||
"branch/#{source_tag}"
|
||||
end
|
||||
"#{source_base_url}/#{suffix}"
|
||||
else
|
||||
source_base_url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def user_agent
|
||||
|
|
Loading…
Reference in a new issue