factoriotools / factorio-docker

Factorio headless server in a Docker container
https://hub.docker.com/r/factoriotools/factorio/
MIT License
1.08k stars 241 forks source link

Working Update to 2.0.7 #503

Closed eliasstepanik closed 1 month ago

Aareksio commented 1 month ago

I am positive the hash you use is a hash of the factorio headless bundle, not the docker container. Docker build job failed. Nevermind :)

LsHallo commented 1 month ago

I don't thinks this will work. update.sh needs to be adjusted.

eliasstepanik commented 1 month ago

I don't thinks this will work. update.sh needs to be adjusted.

Worked for me. But I will have a look if there is some adjustment needed.

LsHallo commented 1 month ago

Yeah but you are not github actions running update.sh and overwriting docker-compose.yml and buildinfo.json when you run.

miragecentury commented 1 month ago
stable_sha256=$(curl "https://factorio.com/download/sha256sums/" | grep "factorio_headless_x64_${stable_online_version}.tar.xz" | awk '{print $1}')
experimental_sha256=$(curl "https://factorio.com/download/sha256sums/" | grep "factorio_headless_x64_${experimental_online_version}.tar.xz" | awk '{print $1}')
e6a64a9ee5b1d3773cd1f40aa5cf78e91960eade6c508fd365c34752afdf2762  factorio-headless_linux_2.0.7.tar.xz

Need to fix the filename

LsHallo commented 1 month ago

Need to fix the filename

But only from 1.2.0 onward. That's the hard part im hung up on rn.

miragecentury commented 1 month ago

No need the script only take new version and from my understanding, they will never release any 1.... version. The game (without the DLC) will be keep in the 2... core. If I am wrong, we can fix it later.

HeartyShow commented 1 month ago

Can't we do a simple condition then, considering they'll probably keep the new naming scheme from now on ? Or do we want to do some regex shanenigans to look for headless and 2.x.x ?

jonojr commented 1 month ago

This greps using both styles of string, in case they go back and forth: curl "https://factorio.com/download/sha256sums/" | grep -E "factorio_headless_x64_${stable_online_version}.tar.xz|factorio-headless_linux_${stable_online_version}.tar.xz" | awk '{print $1}'

MrBasicX commented 1 month ago

curl "https://factorio.com/download/sha256sums/" | grep -E "(factorio_headless_x64_|factorio-headless_linux_)${stable_online_version}.tar.xz" | awk '{print $1}'

Fank commented 1 month ago

Tell when I can merge

eliasstepanik commented 1 month ago

Nice code cleaning/commenting and fix at the same time

Needs testing!

HeartyShow commented 1 month ago

Could you revert the commits of the hardcoded SHAs though

eliasstepanik commented 1 month ago

At the moment I am still working so could somebody test the update.sh.

LsHallo commented 1 month ago

At the moment I am still working so could somebody test the update.sh.

Let it run for 5min. Does not seem to be exiting. Gets to after sha256 sum retrieve step then hangs.

Output:

after fetch
after sha256

modified with debug output:

#!/bin/bash
set -e
SEMVER_REGEX="^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"

# Fetch online stable and experimental versions
stable_online_version=$(curl -s 'https://factorio.com/api/latest-releases' | jq '.stable.headless' -r)
experimental_online_version=$(curl -s 'https://factorio.com/api/latest-releases' | jq '.experimental.headless' -r)

echo "after fetch"

# Fetch SHA256 checksums
stable_sha256=$(curl -s "https://factorio.com/get-download/${stable_online_version}/headless/linux64" | grep "factorio_headless_x64_${stable_online_version}.tar.xz" | awk '{print $1}')
experimental_sha256=$(curl -s "https://factorio.com/get-download/${experimental_online_version}/headless/linux64" | grep "factorio_headless_x64_${experimental_online_version}.tar.xz" | awk '{print $1}')

echo "after sha256"

# Current versions in buildinfo.json
stable_current_version=$(jq -r 'with_entries(select(contains({value:{tags:["stable"]}}))) | keys | .[0]' buildinfo.json)
latest_current_version=$(jq -r 'with_entries(select(contains({value:{tags:["latest"]}}))) | keys | .[0]')

echo "from buildinfo"

# Output version information
echo "stable_online_version=${stable_online_version} experimental_online_version=${experimental_online_version}"
echo "stable_current_version=${stable_current_version} latest_current_version=${latest_current_version}"

echo "after version match"
jonojr commented 1 month ago

At the moment I am still working so could somebody test the update.sh.

I can confirm that it is not working, looking at fixes now

LsHallo commented 1 month ago

yq: -i/--in-place can only be used with -y/-Y now this happens

eliasstepanik commented 1 month ago

Sadly I don't have anymore time today. I hope you can resolve the Problems.

miragecentury commented 1 month ago

https://github.com/factoriotools/factorio-docker/pull/505 ? seem the good fixes ?

jonojr commented 1 month ago

Thinking we might need to move to: https://github.com/factoriotools/factorio-docker/pull/505

Fank commented 1 month ago

I merged #505 for a quick fix, but I would like to see this change as well, because of the cleanup. There are conflicts now, but these should be small.

miragecentury commented 1 month ago

I merged #505 for a quick fix, but I would like to see this change as well, because of the cleanup. There are conflicts now, but these should be small.

Yes but it will be better to just have an MR with the cleanup. Here, we clean also the .json file.