https://kotlinlang.org logo
#touchlab-tools
Title
# touchlab-tools
s

siraf

02/10/2023, 1:07 PM
Hi everyone, We are trying to setup the KMM Bridge. Before, we had both Kotlin and iOS code cloned in the same directory and it worked, but now we want to setup the KMM Bridge to avoid cloning Kotlin code. We are following this tutorial and the issues came on the 3rd step. After running
All Publish
action on Github, the build crashes after ~12 mins. Firstly the issues was that it was not able to find our Podspec repo, saying
If it has not yet been cloned, add it via "pod repo add"
. Not sure why, but we changed the Podspec repo from Private to Public and rerun the action. This time it does not show that error but it still crashes, on the images below you can see what I found useful from the logs :
this is what can also be useful:
r

russhwolf

02/10/2023, 4:33 PM
A 409 error usually indicates that the plugin tried to push a binary but there was already something there. This happens sometimes when a publish operation fails and doesn't complete. A workaround is to bump your version number to force it to publish something new. Alternatively you could manually remove the conflicting binary.
s

siraf

02/13/2023, 7:50 AM
thanks @russhwolf Can you please clarify these two things: 1. You said:
there was already something there
Where? 2.
A workaround is to bump your version number
Version number of what?
r

russhwolf

02/13/2023, 3:37 PM
1. Wherever you're publishing your binaries to. If you followed the kickstart tutorial, it will configure a special maven repo under github packages and save artifacts there 2. The version number of your shared library. The plugin reads your
project.version
or you can set a
versionPrefix
in the
kmmbridge
block. Whichever you do, a patch version will be appended each time you publish.
l

Landry Norris

02/13/2023, 7:28 PM
I have also contacted GitHub support about this. There is a known bug that causes false 409s to be returned sporadically. They were looking into this at the time (few months ago), but I saw this earlier today, so it’s obviously not quite fixed yet,
My team publishes a project with many targets (about 60) very often, and we see the false 409 on GitHub Packages about once a month on average. It’s often well into publishing targets, so it’s not always a repeat upload.
s

siraf

02/13/2023, 9:59 PM
Thanks guys. We are always getting that 409 error, dont know if our gradle file could be helpful to see, or at least part of it? Yes we followed the kickstart tutorial. I have tried with
versionPrefix
, no luck. I have tried both spm and cocoapods and still the same issue. Could the issue be that we need an admin access on any of the repos? Or maybe something wrong with the
deployKeys
? I have admin access on kmmbridge repo, but not on the Kotlin and Podspec repo, another admin has uploaded keys which I made using command.
l

Landry Norris

02/13/2023, 10:38 PM
Having the wrong key should give 401 unauthenticated. Conflict says it's already there. What happens if you change the version to something you've never published before, like 0.1.1-2?
s

siraf

02/14/2023, 10:32 AM
Not sure how changing versions could help and how it is already there because none of our actions has ever succeeded. However, I also tried that and tried changing groupID, none helped.
r

russhwolf

02/14/2023, 2:54 PM
Seeing your project would probably help at this point. Gradle files and build logs are most useful. I'm out of guesses if changing version and group didn't make a difference. Are you sure you were getting the same error and not a different one?
s

siraf

02/14/2023, 3:03 PM
Here is the gradle file, everything is the same as in the TouchLab’s kickstart template repo, except this kmmbridge part:
Copy code
kmmbridge {
    mavenPublishArtifacts()
githubReleaseVersions()   versionPrefix.set("1.0.0")
cocoapods("git@github.com:something/sts-podspecs.git")
}
Here is the
gradle.properties
file, only the Group has been edited:
Copy code
kotlin.code.style=official
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2g

LIBRARY_VERSION=0.1
GROUP=com.something.kmmbridge
KMMBridge-publish.yml
and
All-publish.yml
are not changed, only the last line was uncommented as required in the tutorial:
Copy code
PODSPEC_SSH_KEY: ${{ secrets.PODSPEC_SSH_KEY }}
PODSPEC_SSH_KEY is correct name, checked.
Here is the log file, there is no more error
409
after changing groupID and versionPrefix Now the issue is:
Task :allshared:pushRemotePodspec FAILED
and
Copy code
error: [!] Unable to find the `git@github.com:something/sts-podspecs.git` repo. If it has not yet been cloned, add it via `pod repo add``
podspec repo is public and I made sure that the path to it is correct
r

russhwolf

02/14/2023, 3:33 PM
The error is
Copy code
error: Cloning spec repo `some-repo` from `git@github.com:something/sts-podspecs.git`
error: [!] Unable to find the `git@github.com:something/sts-podspecs.git` repo. If it has not yet been cloned, add it via `pod repo add`.
The
pod repo add
is a red herring. This error generally happens when the github runner doesn't have access to the podspec repo. Do you have a deploy key set up correctly?
l

Landry Norris

02/14/2023, 3:34 PM
Looks like the repo is public
r

russhwolf

02/14/2023, 3:36 PM
the pod publish needs write access, so public or not you still need to configure a deploy key afaik
s

siraf

02/14/2023, 5:25 PM
Generated the keys again, everything is fine with them. not sure why cannot it push the podspec. Is there any specific configuration I need in my Podspec file? Or maybe I need to do something with branches on podspec repo, right now everything is on main branch.
Looks like the logs are a bit different this time
r

russhwolf

02/14/2023, 5:51 PM
ERROR: The key you are authenticating with has been marked as read only.
Make sure you check "allow write access" when adding the deploy key
s

siraf

02/15/2023, 5:49 PM
@russhwolf Thats correct! We needed to upload the deployKey again and give it the
write
access. FYI @kpgalligan @Landry Norris It would be good to update this part of tutorial to let people know that they need to put the checkmark here:
we have successfully imported
allshared
pod in Xcode, but looks like the tutorial is not uptodate, we needed to print the hello-method this way(different that in tutorial)
Copy code
print(BreedsHelloKotlin().sayHello())
I hope it wont be problem to replace this allshared with our existing KMM repo
r

russhwolf

02/16/2023, 4:20 PM
Thanks for the notes. I guess we've drifted a bit since the tutorial was last updated.
119 Views