Package.resolve isn't updated after update Package.swift
ra1028 opened this issue Β· comments
What Renovate type are you using?
Renovate for GitHub
Describe the bug
Renovate supports Swift Package Manager, but Package.resolved
isn't updated after Package.swift
is updated.
That's a lock file of Swift tool dependencies, so it should be updated if it exists on git, otherwise, always diff will be made on the local environment after only Package.swift
is updated.
Relevant debug logs
There is no such thing as a log, as it's a specification failure, not a runtime error.
To Reproduce
This happens whenever there is an update to the Swift package listed in Package.swift
.
Thanks, this feature is not yet supported. Please assist by providing:
- Link(s) to where this is best documented
- Any guides to how this can be run under Linux
- A public repo that reproduces the problem/requirement
@rarkins
Hi, thanks for your response.
I've created a sample public repository about this issue.
Link(s) to where this is best documented
renovate swift document: https://docs.renovatebot.com/modules/manager/swift
sample pr: ra1028/sample-renovate6924#1
Any guides to how this can be run under Linux
Just run swift package update
after Package.swift
is updated on the image that Swift lang is installed.
A public repo that reproduces the problem/requirement
Definitely update and not resolve?
Also I was hoping for Swift's own documentation rather than ours, plus any examples of running it in Ubuntu 18.04 under Docker, or something close.
As you can see, Package.resolved
is not changed after Package.swift
is updated.
ra1028/sample-renovate6924#1
Swift package manager documentation:
I think we need to call swift package resolve
this will only update the resolved file, while swift package update
updates the swift file too with latest available updates
I think it should be swift package resolve and not swift package update
Official docker images: https://hub.docker.com/_/swift
docker file:
https://github.com/apple/swift-docker/blob/bcaa665ab185e9af7d82612c9436950e92466451/5.2/ubuntu/18.04/Dockerfile
we need to update our buildpack and a new gitrepo for docker-swift
then renovate needs to extract tools version from comment to use correct swift version
// swift-tools-version:5.3
We can use git-tags as datasource with a regex versioning swift-5.2.5-RELEASE
I think we need use stabillityDays=1
to wait for build binaries.
New repo: https://github.com/renovatebot/docker-swift
Buildpack issue: renovatebot/docker-buildpack#50
Yes
which swift version we should build? Where to start? v5, v5.3, v4 ...
which swift version we should build? Where to start? v5, v5.3, v4 ...
I propose v5.3, as this supports updating older resolved files and supports ubuntu 20.04 focal
Thank you for providing a reproduction! π π
The Renovate team will take a look at the reproduction repository. Once we confirm the provided repository reproduces the problem, the label will be changed to reproduction:confirmed
.
I am waiting for this.
Are there any plans to proceed with the PR review?
This can now continued, as the refactorings are done.
Is it possible to continue on that issue? It would be great. What was the issue with the closed PR?
@Fab1n sure, please go ahead
Is it possible to continue on that issue? It would be great. What was the issue with the closed PR?
the author didn't respond to our requested changes for a long time.
Seems this issue was left in limbo. It's over 3 years since it was reported.
hi π any updates that we will proceed this PR? we are also looking forward to it π
Earlier today my Lead iOS Engineer raised this as being a useful feature addition to our Renovate workflow.
Is there any pre-req items I should be aware of for this feature? I'd be happy to try and contribute it, although my interactions with Swift Package Manager are exactly undefined
atm π
Swift seems supported already in Containerbase: https://github.com/search?q=repo%3Acontainerbase%2Fbase%20swift&type=code
Hopefully this reproduction repo is still valid: https://github.com/ra1028/sample-renovate6924
Hopefully running swift resolve
after a package file update is enough for a start.
A simple/similar one I added recently is Bun: https://github.com/renovatebot/renovate/blob/main/lib/modules/manager/bun/artifacts.ts
The main difference here is that you probably don't want to treat it as a Buffer/binary file although even that might work.
I think it should be swift package resolve and not swift package update
ok so there seams to be confusion about this. It should be swift package update
from the start. You should not suggest to update the Package.swift. Package.swift should be edited manually. The Package.swift file defines the minimum version a library is compatible with, the Package.resolved defines the version that is used during build.
Note: As a reference you could read package resolved docs
I will try to clarify why updating Package.swift for a dependency is not the way to go. The goal of the bot should be to detect wether there are updates available for the package. If versioning is done correctly it could suggest updates that can be done automatically. This is what swift package update
does. It checks the package.swift file for how dependencies are defined and updates the once that are needed.
So the update process is handled by swift package update
.
swift package resolve
will resolve to the latest version that it can use based on what is defined in the package.swift file. But it will not go fetch the dependencies to be ready for build.
So in short if you would want to make the bot check wether ar not there are updates it should
- mv the package.resolved (if present) to a temp copy
- do swift package resolve
- diff the 2 resolved files
- come up with a suggestion of update
The updated version should then be committed to the resolved file.
When to update the Package.swift then?
When the library needs features that are in the next version of the dependency, effectively making it incompatible with packages that cannot yet update to that version number.
Swift runs just fine in linux and you have installation options at https://www.swift.org/install/#:~:text=on%20download%20page.-,Linux,-Docker
As for github actions the latest ubuntu has swift build in so you do not need to do anything.
is swift still unsupported by renovatebot yet?