mirror of
https://github.com/cirruslabs/tart.git
synced 2026-10-17 11:25:33 +02:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a336965140 | ||
|
|
6d1d8a3773 |
-163
@@ -1,163 +0,0 @@
|
|||||||
use_compute_credits: true
|
|
||||||
|
|
||||||
task:
|
|
||||||
name: Test
|
|
||||||
alias: test
|
|
||||||
persistent_worker:
|
|
||||||
labels:
|
|
||||||
name: dev-mini
|
|
||||||
resources:
|
|
||||||
tart-vms: 1
|
|
||||||
build_script:
|
|
||||||
- swift build
|
|
||||||
test_script:
|
|
||||||
# Add /usr/sbin to PATH, otherwise testDiskutilInfo() fails to locate "diskutil"
|
|
||||||
- export PATH=$PATH:/usr/sbin
|
|
||||||
- swift test
|
|
||||||
integration_test_script:
|
|
||||||
- codesign --sign - --entitlements Resources/tart-dev.entitlements --force .build/debug/tart
|
|
||||||
- export PATH=$(pwd)/.build/arm64-apple-macosx/debug:$PATH
|
|
||||||
# Run integration tests
|
|
||||||
- cd integration-tests
|
|
||||||
- python3 -m venv --symlinks venv
|
|
||||||
- source venv/bin/activate
|
|
||||||
- pip install -r requirements.txt
|
|
||||||
- pytest --verbose --junit-xml=pytest-junit.xml
|
|
||||||
- go test -v ./...
|
|
||||||
pytest_junit_result_artifacts:
|
|
||||||
path: "integration-tests/pytest-junit.xml"
|
|
||||||
format: junit
|
|
||||||
|
|
||||||
task:
|
|
||||||
name: Markdown Lint
|
|
||||||
only_if: $CIRRUS_BRANCH != 'gh-pages' && changesInclude('**.md')
|
|
||||||
container:
|
|
||||||
image: node:latest
|
|
||||||
install_script: npm install -g markdownlint-cli
|
|
||||||
lint_script: markdownlint --config=docs/.markdownlint.yml docs/
|
|
||||||
|
|
||||||
task:
|
|
||||||
name: Lint
|
|
||||||
alias: lint
|
|
||||||
macos_instance:
|
|
||||||
image: ghcr.io/cirruslabs/macos-runner:tahoe
|
|
||||||
lint_script:
|
|
||||||
- swift package plugin --allow-writing-to-package-directory swiftformat --cache ignore --lint --report swiftformat.json .
|
|
||||||
always:
|
|
||||||
swiftformat_report_artifacts:
|
|
||||||
path: swiftformat.json
|
|
||||||
format: swiftformat
|
|
||||||
|
|
||||||
task:
|
|
||||||
only_if: $CIRRUS_TAG == ''
|
|
||||||
env:
|
|
||||||
matrix:
|
|
||||||
BUILD_ARCH: arm64
|
|
||||||
BUILD_ARCH: x86_64
|
|
||||||
name: Build ($BUILD_ARCH)
|
|
||||||
alias: build
|
|
||||||
macos_instance:
|
|
||||||
image: ghcr.io/cirruslabs/macos-runner:tahoe
|
|
||||||
build_script: swift build --arch $BUILD_ARCH --product tart
|
|
||||||
sign_script: codesign --sign - --entitlements Resources/tart-dev.entitlements --force .build/$BUILD_ARCH-apple-macosx/debug/tart
|
|
||||||
binary_artifacts:
|
|
||||||
path: .build/$BUILD_ARCH-apple-macosx/debug/tart
|
|
||||||
|
|
||||||
task:
|
|
||||||
only_if: $CIRRUS_TAG == '' && ($CIRRUS_USER_PERMISSION == 'write' || $CIRRUS_USER_PERMISSION == 'admin')
|
|
||||||
name: Release (Dry Run)
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
||||||
- build
|
|
||||||
macos_instance:
|
|
||||||
image: ghcr.io/cirruslabs/macos-runner:tahoe
|
|
||||||
env:
|
|
||||||
MACOS_CERTIFICATE: ENCRYPTED[552b9d275d1c2bdbc1bff778b104a8f9a53cbd0d59344d4b7f6d0ca3c811a5cefb97bef9ba0ef31c219cb07bdacdd2c2]
|
|
||||||
AC_PASSWORD: ENCRYPTED[4a761023e7e06fe2eb350c8b6e8e7ca961af193cb9ba47605f25f1d353abc3142606f412e405be48fd897a78787ea8c2]
|
|
||||||
GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!]
|
|
||||||
GORELEASER_KEY: ENCRYPTED[!9b80b6ef684ceaf40edd4c7af93014ee156c8aba7e6e5795f41c482729887b5c31f36b651491d790f1f668670888d9fd!]
|
|
||||||
setup_script:
|
|
||||||
- cd $HOME
|
|
||||||
- echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
|
|
||||||
- security create-keychain -p password101 build.keychain
|
|
||||||
- security default-keychain -s build.keychain
|
|
||||||
- security unlock-keychain -p password101 build.keychain
|
|
||||||
- security import certificate.p12 -k build.keychain -P password101 -T /usr/bin/codesign -T /usr/bin/pkgbuild
|
|
||||||
- security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password101 build.keychain
|
|
||||||
- xcrun notarytool store-credentials "notarytool" --apple-id "hello@cirruslabs.org" --team-id "9M2P8L4D89" --password $AC_PASSWORD
|
|
||||||
install_script:
|
|
||||||
- brew install go
|
|
||||||
- brew install mitchellh/gon/gon
|
|
||||||
- brew install --cask goreleaser/tap/goreleaser-pro
|
|
||||||
info_script:
|
|
||||||
- security find-identity -v
|
|
||||||
- xcodebuild -version
|
|
||||||
- swift -version
|
|
||||||
goreleaser_script: goreleaser release --skip=publish --snapshot --clean
|
|
||||||
always:
|
|
||||||
dist_artifacts:
|
|
||||||
path: "dist/*"
|
|
||||||
|
|
||||||
task:
|
|
||||||
name: Release
|
|
||||||
only_if: $CIRRUS_TAG != ''
|
|
||||||
depends_on:
|
|
||||||
- lint
|
|
||||||
- build
|
|
||||||
macos_instance:
|
|
||||||
image: ghcr.io/cirruslabs/macos-runner:tahoe
|
|
||||||
env:
|
|
||||||
MACOS_CERTIFICATE: ENCRYPTED[552b9d275d1c2bdbc1bff778b104a8f9a53cbd0d59344d4b7f6d0ca3c811a5cefb97bef9ba0ef31c219cb07bdacdd2c2]
|
|
||||||
AC_PASSWORD: ENCRYPTED[4a761023e7e06fe2eb350c8b6e8e7ca961af193cb9ba47605f25f1d353abc3142606f412e405be48fd897a78787ea8c2]
|
|
||||||
GITHUB_TOKEN: ENCRYPTED[!98ace8259c6024da912c14d5a3c5c6aac186890a8d4819fad78f3e0c41a4e0cd3a2537dd6e91493952fb056fa434be7c!]
|
|
||||||
GORELEASER_KEY: ENCRYPTED[!9b80b6ef684ceaf40edd4c7af93014ee156c8aba7e6e5795f41c482729887b5c31f36b651491d790f1f668670888d9fd!]
|
|
||||||
SENTRY_ORG: cirrus-labs
|
|
||||||
SENTRY_PROJECT: persistent-workers
|
|
||||||
SENTRY_AUTH_TOKEN: ENCRYPTED[!9eaf2875d51b113e2f68598441ff8e6b2e53242e48fcb93633bd75a373fbe2e7caa900d837cc92f0b142b65579731644!]
|
|
||||||
setup_script:
|
|
||||||
- cd $HOME
|
|
||||||
- echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
|
|
||||||
- security create-keychain -p password101 build.keychain
|
|
||||||
- security default-keychain -s build.keychain
|
|
||||||
- security unlock-keychain -p password101 build.keychain
|
|
||||||
- security import certificate.p12 -k build.keychain -P password101 -T /usr/bin/codesign -T /usr/bin/pkgbuild
|
|
||||||
- security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password101 build.keychain
|
|
||||||
- xcrun notarytool store-credentials "notarytool" --apple-id "hello@cirruslabs.org" --team-id "9M2P8L4D89" --password $AC_PASSWORD
|
|
||||||
install_script:
|
|
||||||
- brew install go getsentry/tools/sentry-cli
|
|
||||||
- brew install mitchellh/gon/gon
|
|
||||||
- brew install --cask goreleaser/tap/goreleaser-pro
|
|
||||||
info_script:
|
|
||||||
- security find-identity -v
|
|
||||||
- xcodebuild -version
|
|
||||||
- swift -version
|
|
||||||
release_script: goreleaser
|
|
||||||
upload_sentry_debug_files_script:
|
|
||||||
- cd .build/arm64-apple-macosx/release/
|
|
||||||
# Generate and upload symbols
|
|
||||||
- dsymutil tart
|
|
||||||
- sentry-cli debug-files upload tart.dSYM/
|
|
||||||
- SENTRY_PROJECT=tart sentry-cli debug-files upload tart.dSYM/
|
|
||||||
# Bundle and upload sources
|
|
||||||
- sentry-cli debug-files bundle-sources tart.dSYM
|
|
||||||
- sentry-cli debug-files upload tart.src.zip
|
|
||||||
- SENTRY_PROJECT=tart sentry-cli debug-files upload tart.src.zip
|
|
||||||
create_sentry_release_script:
|
|
||||||
- export SENTRY_RELEASE="tart@$CIRRUS_TAG"
|
|
||||||
- sentry-cli releases new $SENTRY_RELEASE
|
|
||||||
- sentry-cli releases set-commits $SENTRY_RELEASE --auto
|
|
||||||
- sentry-cli releases finalize $SENTRY_RELEASE
|
|
||||||
|
|
||||||
task:
|
|
||||||
name: Deploy Documentation
|
|
||||||
only_if: $CIRRUS_BRANCH == 'main'
|
|
||||||
container:
|
|
||||||
image: ghcr.io/squidfunk/mkdocs-material:latest
|
|
||||||
registry_config: ENCRYPTED[!cf1a0f25325aa75bad3ce6ebc890bc53eb0044c02efa70d8cefb83ba9766275a994b4831706c52630a0692b2fa9cfb9e!]
|
|
||||||
env:
|
|
||||||
DEPLOY_TOKEN: ENCRYPTED[!45ed45666558902ed1c2400add734ec063103bec31841847e8c8764802fca229bfa6d85c690e16ad159e047574b48793!]
|
|
||||||
deploy_script:
|
|
||||||
- git config --global user.name "Cirrus CI"
|
|
||||||
- git config --global user.name "hello@cirruslabs.org"
|
|
||||||
- git remote set-url origin https://$DEPLOY_TOKEN@github.com/cirruslabs/tart/
|
|
||||||
- mkdocs --verbose gh-deploy --force --remote-branch gh-pages
|
|
||||||
+176
-22
@@ -1,37 +1,191 @@
|
|||||||
name: Build
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_cached:
|
markdown_lint:
|
||||||
name: Build tart (cached)
|
name: Markdown Lint
|
||||||
runs-on: ghcr.io/cirruslabs/macos-runner:tahoe
|
if: github.ref != 'refs/heads/gh-pages'
|
||||||
timeout-minutes: 30
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Build
|
- uses: actions/setup-node@v5
|
||||||
run: |
|
with:
|
||||||
export COMPILATION_CACHE_ENABLE_CACHING=YES
|
node-version: lts/*
|
||||||
export COMPILATION_CACHE_REMOTE_SERVICE_PATH="$HOME/.cirruslabs/omni-cache.sock"
|
- name: Install markdownlint
|
||||||
export COMPILATION_CACHE_ENABLE_PLUGIN=YES
|
run: npm install -g markdownlint-cli
|
||||||
export COMPILATION_CACHE_ENABLE_INTEGRATED_QUERIES=YES
|
- name: Lint Markdown
|
||||||
export COMPILATION_CACHE_ENABLE_DETACHED_KEY_QUERIES=YES
|
run: markdownlint --config=docs/.markdownlint.yml docs/
|
||||||
export SWIFT_ENABLE_COMPILE_CACHE=YES
|
|
||||||
export SWIFT_ENABLE_EXPLICIT_MODULES=YES
|
|
||||||
export SWIFT_USE_INTEGRATED_DRIVER=YES
|
|
||||||
export CLANG_ENABLE_COMPILE_CACHE=YES
|
|
||||||
export CLANG_ENABLE_MODULES=YES
|
|
||||||
swift build --build-system swiftbuild --product tart
|
|
||||||
|
|
||||||
build_no_cache:
|
lint:
|
||||||
name: Build tart (no cache)
|
name: Lint
|
||||||
runs-on: ghcr.io/cirruslabs/macos-runner:tahoe
|
runs-on: macos-15
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- name: SwiftFormat
|
||||||
|
run: swift package plugin --allow-writing-to-package-directory swiftformat --cache ignore --lint --report swiftformat.json .
|
||||||
|
- name: Upload SwiftFormat report
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: swiftformat-report
|
||||||
|
path: swiftformat.json
|
||||||
|
if-no-files-found: ignore
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: macos-15
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Build
|
- name: Build
|
||||||
run: swift build --build-system swiftbuild --product tart
|
run: swift build
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
export PATH="$PATH:/usr/sbin"
|
||||||
|
swift test
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build (${{ matrix.arch }})
|
||||||
|
if: github.ref_type != 'tag'
|
||||||
|
runs-on: macos-15
|
||||||
|
timeout-minutes: 30
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
arch:
|
||||||
|
- arm64
|
||||||
|
- x86_64
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- name: Build
|
||||||
|
run: swift build --arch "${{ matrix.arch }}" --product tart
|
||||||
|
- name: Sign
|
||||||
|
run: codesign --sign - --entitlements Resources/tart-dev.entitlements --force ".build/${{ matrix.arch }}-apple-macosx/debug/tart"
|
||||||
|
- name: Upload binary
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: tart-${{ matrix.arch }}
|
||||||
|
path: .build/${{ matrix.arch }}-apple-macosx/debug/tart
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
release_dry_run:
|
||||||
|
name: Release (Dry Run)
|
||||||
|
if: github.event_name != 'pull_request' && github.ref_type != 'tag'
|
||||||
|
needs:
|
||||||
|
- lint
|
||||||
|
- build
|
||||||
|
runs-on: macos-15
|
||||||
|
timeout-minutes: 60
|
||||||
|
env:
|
||||||
|
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
|
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Configure signing
|
||||||
|
run: |
|
||||||
|
cd "$HOME"
|
||||||
|
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
|
||||||
|
security create-keychain -p password101 build.keychain
|
||||||
|
security default-keychain -s build.keychain
|
||||||
|
security unlock-keychain -p password101 build.keychain
|
||||||
|
security import certificate.p12 -k build.keychain -P password101 -T /usr/bin/codesign -T /usr/bin/pkgbuild
|
||||||
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password101 build.keychain
|
||||||
|
xcrun notarytool store-credentials "notarytool" --apple-id "hello@cirruslabs.org" --team-id "9M2P8L4D89" --password "$AC_PASSWORD"
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
brew install go
|
||||||
|
brew install mitchellh/gon/gon
|
||||||
|
brew install --cask goreleaser/tap/goreleaser-pro
|
||||||
|
- name: Print tool versions
|
||||||
|
run: |
|
||||||
|
security find-identity -v
|
||||||
|
xcodebuild -version
|
||||||
|
swift -version
|
||||||
|
- name: Run GoReleaser
|
||||||
|
run: goreleaser release --skip=publish --snapshot --clean
|
||||||
|
- name: Upload dist
|
||||||
|
if: always()
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dist-dry-run
|
||||||
|
path: dist/*
|
||||||
|
if-no-files-found: ignore
|
||||||
|
|
||||||
|
release:
|
||||||
|
name: Release
|
||||||
|
if: github.ref_type == 'tag'
|
||||||
|
needs:
|
||||||
|
- lint
|
||||||
|
runs-on: macos-15
|
||||||
|
timeout-minutes: 60
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
env:
|
||||||
|
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||||
|
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Configure signing
|
||||||
|
run: |
|
||||||
|
cd "$HOME"
|
||||||
|
echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
|
||||||
|
security create-keychain -p password101 build.keychain
|
||||||
|
security default-keychain -s build.keychain
|
||||||
|
security unlock-keychain -p password101 build.keychain
|
||||||
|
security import certificate.p12 -k build.keychain -P password101 -T /usr/bin/codesign -T /usr/bin/pkgbuild
|
||||||
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password101 build.keychain
|
||||||
|
xcrun notarytool store-credentials "notarytool" --apple-id "hello@cirruslabs.org" --team-id "9M2P8L4D89" --password "$AC_PASSWORD"
|
||||||
|
- name: Install tools
|
||||||
|
run: |
|
||||||
|
brew install go
|
||||||
|
brew install mitchellh/gon/gon
|
||||||
|
brew install --cask goreleaser/tap/goreleaser-pro
|
||||||
|
- name: Print tool versions
|
||||||
|
run: |
|
||||||
|
security find-identity -v
|
||||||
|
xcodebuild -version
|
||||||
|
swift -version
|
||||||
|
- name: Run GoReleaser
|
||||||
|
run: goreleaser
|
||||||
|
|
||||||
|
deploy_docs:
|
||||||
|
name: Deploy Documentation
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
container:
|
||||||
|
image: ghcr.io/squidfunk/mkdocs-material:latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- name: Deploy documentation
|
||||||
|
run: |
|
||||||
|
git config --global user.name "github-actions[bot]"
|
||||||
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
|
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
|
||||||
|
mkdocs --verbose gh-deploy --force --remote-branch gh-pages
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ControlSocket {
|
|||||||
func run() async throws {
|
func run() async throws {
|
||||||
// Remove control socket file from previous "tart run" invocations,
|
// Remove control socket file from previous "tart run" invocations,
|
||||||
// if any, otherwise we may get the "address already in use" error
|
// if any, otherwise we may get the "address already in use" error
|
||||||
try? FileManager.default.removeItem(atPath: controlSocketURL.path)
|
try? FileManager.default.removeItem(atPath: controlSocketURL.path())
|
||||||
|
|
||||||
// Change the current working directory to a VM's base directory
|
// Change the current working directory to a VM's base directory
|
||||||
// to work around Unix domain socket 104 byte limitation [1]
|
// to work around Unix domain socket 104 byte limitation [1]
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
import XCTest
|
|
||||||
@testable import tart
|
|
||||||
|
|
||||||
final class ControlSocketURLTests: XCTestCase {
|
|
||||||
func testControlSocketURLResolvesToAbsolutePath() throws {
|
|
||||||
let baseURL = URL(fileURLWithPath: "/Users/test/.tart/vms/myvm/")
|
|
||||||
let vmDir = VMDirectory(baseURL: baseURL)
|
|
||||||
|
|
||||||
// The .path property resolves relative URLs to absolute paths,
|
|
||||||
// which is required for stale socket cleanup in ControlSocket.run()
|
|
||||||
// since it happens before the working directory is changed.
|
|
||||||
XCTAssertEqual(
|
|
||||||
vmDir.controlSocketURL.path,
|
|
||||||
"/Users/test/.tart/vms/myvm/control.sock"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func testControlSocketURLRelativePathIsJustFilename() throws {
|
|
||||||
let baseURL = URL(fileURLWithPath: "/Users/test/.tart/vms/myvm/")
|
|
||||||
let vmDir = VMDirectory(baseURL: baseURL)
|
|
||||||
|
|
||||||
// The .relativePath is used for socket binding after cwd is changed
|
|
||||||
XCTAssertEqual(
|
|
||||||
vmDir.controlSocketURL.relativePath,
|
|
||||||
"control.sock"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import requests
|
||||||
|
|
||||||
|
from testcontainers.core.waiting_utils import wait_container_is_ready
|
||||||
from testcontainers.core.container import DockerContainer
|
from testcontainers.core.container import DockerContainer
|
||||||
from testcontainers.core.wait_strategies import HttpWaitStrategy
|
|
||||||
|
|
||||||
|
|
||||||
class DockerRegistry(DockerContainer):
|
class DockerRegistry(DockerContainer):
|
||||||
@@ -8,9 +10,11 @@ class DockerRegistry(DockerContainer):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("registry:2")
|
super().__init__("registry:2")
|
||||||
self.with_exposed_ports(self._default_exposed_port)
|
self.with_exposed_ports(self._default_exposed_port)
|
||||||
self.waiting_for(HttpWaitStrategy(self._default_exposed_port, "/v2/").for_status_code(200))
|
|
||||||
|
|
||||||
|
@wait_container_is_ready(requests.exceptions.ConnectionError)
|
||||||
def remote_name(self, for_vm: str):
|
def remote_name(self, for_vm: str):
|
||||||
exposed_port = self.get_exposed_port(self._default_exposed_port)
|
exposed_port = self.get_exposed_port(self._default_exposed_port)
|
||||||
|
|
||||||
|
requests.get(f"http://127.0.0.1:{exposed_port}/v2/")
|
||||||
|
|
||||||
return f"127.0.0.1:{exposed_port}/tart/{for_vm}:latest"
|
return f"127.0.0.1:{exposed_port}/tart/{for_vm}:latest"
|
||||||
|
|||||||
Reference in New Issue
Block a user