Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rattler-build login #334

Closed
pavelzw opened this issue Nov 21, 2023 · 7 comments
Closed

rattler-build login #334

pavelzw opened this issue Nov 21, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@pavelzw
Copy link
Collaborator

pavelzw commented Nov 21, 2023

There is currently no way of logging into private channels using rattler-build without using pixi auth login. Would be nice to have a standalone way of doing this.

@pavelzw pavelzw added the enhancement New feature or request label Nov 21, 2023
@pavelzw
Copy link
Collaborator Author

pavelzw commented Dec 9, 2023

This actually got more important for us now.
The workaround with using pixi auth login only works when there is no keychain.
In CI on macos-latest, I have the following situation:

    runs-on: macos-latest
    timeout-minutes: 5
...
      - name: Install rattler-build
        uses: mamba-org/setup-micromamba@54d4d5980e1a4aa7cdc8b050cf2d19b7e262ce18
        with:
          environment-name: build
          create-args: >-
            rattler-build=0.6.0
          cache-environment: true
      - uses: prefix-dev/setup-pixi@ccc5c07ed948b849df4b3578d785f3afd7465c67
        with:
          run-install: false
          auth-host: https://my-quetz-instance.com
          auth-conda-token: ${{ secrets.QUETZ_API_KEY }}
      - name: Build conda package
        run: >-
          rattler-build build
          --recipe conda.recipe/recipe.yaml
          -c conda-forge
          -c https://my-quetz-instance.com/get/private-channel

Looking at the logs of this workflow, I can see the following:

Copied ...

Resolving for environment specs:
 - clang_osx-64 15.*


Error: The operation was canceled.

What's happening is that pixi writes the secret to the keychain and rattler-build tries to read the secret from the keychain. This triggers an interactive auth prompt and the workflow gets canceled after timeout-minutes.

@0xbe7a
Copy link
Contributor

0xbe7a commented Dec 9, 2023

You can get rattler-build running on macos for now by manually preparing the keyring with the following bash script:

account_name="your.quetz.server.com"
path=$(which rattler-build)
token="your conda-token"
cdhash=$(/usr/bin/codesign -dvvv $path 2>&1 | grep 'CDHash=' | cut -d'=' -f2)
password="rattler"

security create-keychain -p $password build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $password build.keychain

security add-generic-password -a $account_name -s rattler -A build.keychain
pixi auth login --conda-token $token https://$account_name
security set-generic-password-partition-list -S cdhash:$cdhash -s rattler -a $account_name -k $password build.keychain

@pavelzw
Copy link
Collaborator Author

pavelzw commented Dec 12, 2023

@0xbe7a's hack works on M1 runners (rattler-build is signed there by default). On regular x64 runners, you still need to run /usr/bin/codesign --sign - --force "$rattler_build_path" after password="rattler".

But then, it works.

@wolfv
Copy link
Member

wolfv commented Dec 12, 2023

Hi @0xbe7a and @pavelzw – is the problem that the rattler-build binary is not signed with an Apple Certificate? We built some CI to do this for pixi that we could / should copy over.

I do like Bela's force fallback storage option. I am wondering if we should instead implement this as another "auth storage" using generics.

@pavelzw
Copy link
Collaborator Author

pavelzw commented Dec 12, 2023

is the problem that the rattler-build binary is not signed with an Apple Certificate?

yeah, that's one problem

We built some CI to do this for pixi that we could / should copy over.

This won't fix our specific use case since we are installing rattler-build straight from conda-forge

@pavelzw
Copy link
Collaborator Author

pavelzw commented Dec 18, 2023

With the newest main build (fa672b9), you can do something like

echo '{"my.quetz.server": {"CondaToken": "${{ inputs.quetz-api-key }}"}}' > ${{ runner.temp }}/credentials.json
echo "RATTLER_AUTH_FILE=${{ runner.temp }}/credentials.json" >> "$GITHUB_ENV"

Still not quite there yet but better than dark codesign magic.

kassoulait pushed a commit to kassoulait/rattler-build that referenced this issue Feb 28, 2024
kassoulait pushed a commit to kassoulait/rattler-build that referenced this issue Feb 28, 2024
@pavelzw
Copy link
Collaborator Author

pavelzw commented Mar 10, 2024

Fixed by #685

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants