Code Monkey home page Code Monkey logo

Comments (9)

fkorotkov avatar fkorotkov commented on August 16, 2024

Could you please run file $(which cirrus) to verify cirrus binary is arm64 and not running under Rosetta.

from cirrus-cli.

bartekpacia avatar bartekpacia commented on August 16, 2024
$ file $(which cirrus)
/opt/homebrew/bin/cirrus: Mach-O 64-bit executable arm64

from cirrus-cli.

edigaryev avatar edigaryev commented on August 16, 2024

How does your .cirrus.yml look like (or maybe you can get some reproducible/minimized example)?

from cirrus-cli.

edigaryev avatar edigaryev commented on August 16, 2024

P.S. you probably want to use arm_container instead of just container if your container engine does not support amd64 architecture, see Linux Containers.

from cirrus-cli.

bartekpacia avatar bartekpacia commented on August 16, 2024

This is my .cirrus.star:

.cirrus.star
load(
    "./cirrus/common.star",
    "secrets",
    "setup_1password_cli",
    "setup_credentials",
    "setup_fastlane",
)
load("cirrus", "fs", "yaml")
load(
    "github.com/cirrus-modules/helpers",
    "cache",
    "container",
    "macos_instance",
    "script",
    "task",
)

def main():
    pubspec = fs.read("pubspec.yaml")
    flutter_version = yaml.loads(pubspec)["environment"]["flutter"]

    return [
        task(
            name = "Deploy Android app",
            env = {"CIRRUS_CLONE_TAGS": "true"} | secrets(),
            instance = container(
                image = "ghcr.io/cirruslabs/flutter:%s" % flutter_version,
            ),
            only_if = "$CIRRUS_TAG =~ 'v.*' || $CIRRUS_BRANCH == 'master'",
            instructions = [
                cache("pub", "~/.pub-cache"),
                setup_1password_cli(),
                setup_credentials(),
                setup_fastlane(),
                script(
                    "fastlane_android_distribute",
                    "cd android",
                    """\
if [ "$CIRRUS_TAG" == "v*" ]; then
    op run -- bundle exec fastlane android internal
else
    op run -- bundle exec fastlane android distribute
fi
""",
                ),
            ],
        ),
        task(
            name = "Deploy iOS app",
            env = {"CIRRUS_CLONE_TAGS": "true"} | secrets(),
            instance = macos_instance(
                image = "ghcr.io/cirruslabs/macos-runner:sonoma",
            ),
            only_if = "$CIRRUS_TAG =~ 'v.*' || $CIRRUS_BRANCH == 'master'",
            instructions = [
                cache("cocoapods", "~/.cocoapods"),
                setup_1password_cli(),
                setup_credentials(),
                setup_fastlane(),
                script(
                    "fastlane_ios_distribute",
                    "cd ios",
                    """\
if [ "$CIRRUS_TAG" == "v*" ]; then
    op run -- bundle exec fastlane ios prod
else
    op run -- bundle exec fastlane ios distribute
fi
""",
                ),
            ],
        ),
    ]

It references .common.star, I believe it's not important in this context but just for the sake of it, here it is:

./cirrus/common.star
load("github.com/cirrus-modules/helpers", "script")

def secrets():
    return {
        "OP_SERVICE_ACCOUNT_TOKEN": "ENCRYPTED[6cb47a274401075b0883b77c85a850631b342ec26afc074cc1bf679b6fd18d2ae81e53bde62b2fde49a89374271e82fa]",
    }

def setup_credentials():
    return script(
        "setup_credentials",
        """\
if [ $(uname) = \"Linux\" ]; then
    apt-get update && apt-get install -y jq
fi
""",
        "chmod +x ./setup_credentials && ./setup_credentials",
        'while read -r line; do echo "$line" >> $CIRRUS_ENV; done < .env',
    )

def setup_1password_cli():
    return script(
        "setup_1password_cli",
        """\
if [ $(uname) = \"Linux\" ]; then
    apt-get update && apt-get install -y jq
    %s
elif [ $(uname) = \"Darwin\" ]; then
    %s
fi
""" % (_setup_1password_cli_debian, _setup_1password_cli_macos),
        "echo \"OP_SERVICE_ACCOUNT_KEY: $OP_SERVICE_ACCOUNT_KEY\"",
    )

_setup_1password_cli_debian = """\
# Add key for 1Password APT repository
    curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
    # Add the 1Password apt repository
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/$(dpkg --print-architecture) stable main" | sudo tee /etc/apt/sources.list.d/1password.list
    #Add the debsig-verify policy
    sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/
    curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol
    sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22
    curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg
    # Install 1Password CLI
    apt-get update && apt-get install -y 1password-cli"""

_setup_1password_cli_macos = """\
brew install 1password-cli"""

def setup_fastlane():
    return script(
        "setup_fastlane",
        "gem install bundler",
        "cd android && bundle install",
        "cd ..",
        "cd ios && bundle install",
    )

from cirrus-cli.

bartekpacia avatar bartekpacia commented on August 16, 2024

@edigaryev Using arm_container works for Linux container, but for macOS VM, I encounter #746

from cirrus-cli.

edigaryev avatar edigaryev commented on August 16, 2024

Do I understand correctly that the only issue remaining is that this .cirrus.yml:

macos_instance:
  image: ghcr.io/cirruslabs/macos-runner:sonoma

task:
  script: uname -a

Causes your cirrus run to pull the ghcr.io/cirruslabs/macos-runner:sonoma image?

What does your tart list --source oci | grep macos-runner look like on the machine you're trying to run this?

from cirrus-cli.

bartekpacia avatar bartekpacia commented on August 16, 2024

Do I understand correctly that the only issue remaining is [...]

No, the issue is that when I try to run the image, it throws the error from OP.

Logs
$ cat .cirrus.yaml                                                                                                                                                         exit 1
macos_instance:
  image: ghcr.io/cirruslabs/macos-runner:sonoma

task:
  script: uname -a
$ cirrus run --output simple
Started 'main' task
Started 'pull virtual machine'
Pulling virtual machine ghcr.io/cirruslabs/macos-runner:sonoma...
pulling ghcr.io/cirruslabs/macos-runner:sonoma...
pulling manifest...
ghcr.io/cirruslabs/macos-runner@sha256:e1847298815e8363d590ac31bf08951f9b00f329954cf7a273bd29317085753b image is already cached and linked!
'pull virtual machine' succeeded in 0.8s!
Started 'clone virtual machine'
Cloning virtual machine ghcr.io/cirruslabs/macos-runner:sonoma...
'clone virtual machine' succeeded in 0.1s!
Started 'configure virtual machine'
Configuring virtual machine cirrus-cli-0-f61c8e94-2a8e-4240-ac67-b73f124b848d...
'configure virtual machine' succeeded in 0.0s!
Started 'boot virtual machine'
VM was assigned with 192.168.64.22 IP
'boot virtual machine' succeeded in 14s!
Started 'syncing working directory'
'syncing working directory' succeeded in 19s!
Started 'main' script
uname -a
Darwin admins-Virtual-Machine.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:39 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_VMAPPLE arm64
'main' script succeeded in 1.0s!
agent warning: Encountered an error while gathering resource utilization metrics: failed to query total CPU count/memory amount: not implemented yet
agent warning: Encountered an error while gathering resource utilization metrics: failed to query CPU usage using gopsutil on darwin/arm64: not implemented yet
'main' task succeeded in 40s!

What does your tart list --source oci | grep macos-runner look like on the machine you're trying to run this?

$ tart list --source oci | grep macos-runner
OCI    ghcr.io/cirruslabs/macos-runner:sonoma                                                                        250  142  stopped
OCI    ghcr.io/cirruslabs/macos-runner@sha256:e1847298815e8363d590ac31bf08951f9b00f329954cf7a273bd29317085753b       250  142  stopped

from cirrus-cli.

bartekpacia avatar bartekpacia commented on August 16, 2024

Weirdly, everything seems to work just fine now. I think the most productive thing to do is to close this issue. If I encounter the problem again, I'll create a fully reproducible example.

Thanks for all the help.

from cirrus-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.