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

A keychain with the same name already exists. On second run #8

Open
SoylentGraham opened this issue Jul 4, 2020 · 8 comments
Open

Comments

@SoylentGraham
Copy link

I finally got this working (turns out my organisation secret doesn't propogate to my private repository)

On the second run, I get this error
security: SecKeychainCreate signing_temp.keychain: A keychain with the same name already exists.

At first, I had this on another repository so I called it signing_temp2.keychain, but that also errors the second time.

Am I doing something wrong? Should it error just because it already exists? (same cert/credentials etc)

@b-zurg
Copy link

b-zurg commented Jul 14, 2020

This seems like a problem... I would expect the keychain to be cleared after the action finishes.

@orj
Copy link
Contributor

orj commented Aug 6, 2020

@SoylentGraham are you using a self-hosted agent? Or are you executing the action multiple times in a workflow?

There should be no retained state on GitHub hosted agents.

@orj
Copy link
Contributor

orj commented Aug 6, 2020

@b-zurg The keychain needs to be retained for the entire job not just the action. As Xcode needs to access the keychain.

@SoylentGraham
Copy link
Author

SoylentGraham commented Aug 6, 2020 via email

@juliensechaud
Copy link

@SoylentGraham did you find any workaround ?
I have the same issue here on self-hosted

@paulocoutinhox
Copy link

I have the same problem on github action.

Anyone found a solution?

@paresy
Copy link

paresy commented May 16, 2021

This fork will do a proper post-cleanup: https://github.com/figleafteam/import-codesign-certs

@alexkirsz
Copy link

For self-hosted hosts, you can manually clean the keychain after using it. Here's an example snippet:

jobs:
  build:
    env:
      # Unique keychain name so concurrent jobs don't get confused
      KEYCHAIN: job-${{ github.job }}-${{ github.run_id	}}-${{ github.run_number }}-${{ github.run_attempt }}
    steps:
      - uses: apple-actions/import-codesign-certs@v1
        with:
          keychain: ${{ env.KEYCHAIN }}
          p12-file-base64: ${{ secrets.CERTIFICATE_P12_B64 }}
          p12-password: ${{ secrets.CERTIFICATE_PASSPHRASE }}

      - name: Delete keychain
        if: always() # Always run this step to ensure the keychain is properly disposed of
        run: |
          security delete-keychain "${{ env.KEYCHAIN }}".keychain

rcdailey pushed a commit to recyclarr/import-codesign-certs that referenced this issue Dec 23, 2022
…ple-Actions#8)

* add workflow

* add workflow and remove husky

* prettier tests
prmoore77 added a commit to prmoore77/action-macos-sign-notarize that referenced this issue Feb 28, 2024
prmoore77 added a commit to prmoore77/action-macos-sign-notarize that referenced this issue Feb 28, 2024
floitsch added a commit to toitlang/action-macos-sign-notarize that referenced this issue Mar 4, 2024
This PR should fix the issue described here:
Apple-Actions/import-codesign-certs#8 -
specifically when it is run multiple times in the same job.

---------

Co-authored-by: Florian Loitsch <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants