Skip to content

Commit

Permalink
feat: add env var to disable build service
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Apr 23, 2024
1 parent 80c622f commit e80fdc8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
32 changes: 18 additions & 14 deletions shard.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ shards:

ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 1.5.0
version: 1.6.1

any_hash:
git: https://github.com/sija/any_hash.cr.git
Expand All @@ -35,7 +35,7 @@ shards:

bindata:
git: https://github.com/spider-gazelle/bindata.git
version: 1.11.1
version: 2.0.0

clip:
git: https://github.com/erdnaxeli/clip.git
Expand All @@ -45,17 +45,21 @@ shards:
git: https://github.com/spider-gazelle/connect-proxy.git
version: 2.0.0

cron_parser:
git: https://github.com/kostya/cron_parser.git
version: 0.4.0

csuuid:
git: https://github.com/wyhaines/csuuid.cr.git
version: 1.0.0+git.commit.a4cf9615c6518cf27c68a1755a8c2ac4ae4fe987

db:
git: https://github.com/crystal-lang/crystal-db.git
version: 0.12.0
version: 0.13.1

debug:
git: https://github.com/sija/debug.cr.git
version: 2.0.2
version: 2.0.3

defined:
git: https://github.com/wyhaines/defined.cr.git
Expand All @@ -71,7 +75,7 @@ shards:

exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.3.1
version: 0.4.1

exec_from:
git: https://github.com/place-labs/exec_from.git
Expand All @@ -83,7 +87,7 @@ shards:

git-repository:
git: https://github.com/place-labs/git-repository.git
version: 1.3.1
version: 1.4.0

google:
git: https://github.com/placeos/google.git
Expand All @@ -103,7 +107,7 @@ shards:

jwt:
git: https://github.com/crystal-community/jwt.git
version: 1.6.0
version: 1.6.1

log_helper:
git: https://github.com/spider-gazelle/log_helper.git
Expand Down Expand Up @@ -131,7 +135,7 @@ shards:

office365:
git: https://github.com/placeos/office365.git
version: 1.23.2
version: 1.24.0

open_api:
git: https://github.com/elbywan/open_api.cr.git
Expand Down Expand Up @@ -171,23 +175,23 @@ shards:

pg:
git: https://github.com/will/crystal-pg.git
version: 0.27.0
version: 0.28.0

pg-orm:
git: https://github.com/spider-gazelle/pg-orm.git
version: 1.0.0+git.commit.e614b076c9f185d0891b505ea74c4b5e7e6307b7
version: 1.1.0+git.commit.e35e4c535be1ab47b6afb821723ceafb637fa4e8

place_calendar:
git: https://github.com/placeos/calendar.git
version: 4.19.1
version: 4.20.1

placeos-log-backend:
git: https://github.com/place-labs/log-backend.git
version: 0.11.4

placeos-models:
git: https://github.com/placeos/models.git
version: 9.25.2
version: 9.45.0

pool:
git: https://github.com/ysbaddaden/pool.git
Expand All @@ -199,7 +203,7 @@ shards:

raven:
git: https://github.com/sija/raven.cr.git
version: 1.9.3+git.commit.78ab46f635208faf4a8f48e593de7c5e5490d543
version: 1.9.3+git.commit.990a7650fb027cbe65705fc6dad228cddc76c503

redis:
git: https://github.com/stefanwille/crystal-redis.git
Expand All @@ -219,7 +223,7 @@ shards:

shards:
git: https://github.com/crystal-lang/shards.git
version: 0.17.3
version: 0.18.0

splay_tree_map:
git: https://github.com/wyhaines/splay_tree_map.cr.git
Expand Down
1 change: 1 addition & 0 deletions src/constants.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module PlaceOS::Build
# Build Service
BUILD_SERVICE_URL = ENV["CLOUD_BUILD_SERVER"]?.presence || "https://build.placeos.run"
BUILD_GIT_TOKEN = ENV["GIT_TOKEN"]?.presence
BUILD_SERVICE_DISABLED = ENV["BUILD_SERVICE_DISABLED"]? == "true"

class_getter? production : Bool { PRODUCTION }
class_getter? trace : Bool { TRACE }
Expand Down
4 changes: 3 additions & 1 deletion src/placeos-build/api/driver.cr
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ module PlaceOS::Build::Api
in Build::Compilation::NotFound
head code: :not_found
in Build::Compilation::Success
PlaceOS::Build.call_cloud_build_service(repository_uri, branch || "HEAD", file, commit, username: username, password: password)
if !BUILD_SERVICE_DISABLED
PlaceOS::Build.call_cloud_build_service(repository_uri, branch || "HEAD", file, commit, username: username, password: password)
end
path = builder.binary_store.path(result.executable)

response.content_type = "application/octet-stream"
Expand Down
5 changes: 4 additions & 1 deletion src/placeos-build/cli/build.cr
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ module PlaceOS::Build
password: password,
)
end
PlaceOS::Build.call_cloud_build_service(repository_uri, branch, entrypoint, ref, username: username, password: password)

if !BUILD_SERVICE_DISABLED
PlaceOS::Build.call_cloud_build_service(repository_uri, branch, entrypoint, ref, username: username, password: password)
end
rescue e
Log.warn(exception: e) { "failed to compile #{entrypoint}" }
end
Expand Down

0 comments on commit e80fdc8

Please sign in to comment.