Open Krakinou opened 1 year ago
This should be possible right now, provided the steps exist in the same workflow.
If it does not happen and the images get rebuilt on every run, perhaps your github.token does not have the necessary permission to push the image. After running your workflow, simply look at your project's published "packages". There should be at least one containing the string run-on-arch-action
like here. If there are none, then your token does not have these permissions. In that case, in the github GUI, go the Project settings, select Actions->General in the left pane, then scroll down to Workflow permissions and select Read and write permissions
there, and hit the Save button.
For possible future releases:
Oh, and looking at your example, you also should have the install:
parameter present exactly the same in all invocations. After all, the install step gets saved to the image and if the 2nd and 3rd invocation do not have exactly the same install parameters, this would result in different images.
I do have the package in my repo, so this is not the issue
Oh, and looking at your example, you also should have the install: parameter present exactly the same in all invocations. After all, the install step gets saved to the image and if the 2nd and 3rd invocation do not have exactly the same install parameters, this would result in different images.
I will try to add the exact same install
parameter and check if it works, thanks for the tip!
Hi, thanks @felfert, duplicating the install
is not necessary and until the workflow, arch and distro are still the same the next steps should pickup the original image created with the install step, if you set and configured correctly the token.
Hi,
So I ran a bunch of test and I confirm what @felfert said : install
parameter have to be the same accross multiple steps so that the docker image is not reinstalled again.
If I skip the install parameter, the image is rebuilt at each step (which obviously does not work).
Well, I guess that @uraimo is right. Problem is, that you did just post an example and not the real script that you actually use. I believe you use this one. In there, ALL invocations include the parameter githubToken
which enables the docker push in every step. This is wrong. If you use that parameter in the Build system
step ONLY, then it should work without the duplicated install as well.
Yep, you're correct this is the action I'm working on. Sorry for not giving the full script (as it was quite long with a lot of stuff, I did not want to put too many unrelated info). However, I tried removing the github token parameter and it does not seems to work: I have 2 versions of the same script, one with token+install parameter, and the second one without: The first script is running correctly, with each step re-using the container as installed (. The second one is failling on the first step using run-on-arch without install parameter as it does not find git (which was installed in the container).
Or am I missing something obvious?
So, I made a lighter script to test. Both github token and install part are required so that the steps reused the cached package:
Here is the script:
name: Check run on arch
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name : Build system
uses: uraimo/run-on-arch-action@v2.5.0
with:
arch: armv7
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
echo "Install packages"
apt-get update && apt-get -y install python3
run: |
echo "system installed"
- name : Check system 1 - Token & install
uses: uraimo/run-on-arch-action@v2.5.0
with:
arch: armv7
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
echo "Install packages"
apt-get update && apt-get -y install python3
run: |
echo "this step will run"
python3 --version
- name : Check system 2 - Install only
uses: uraimo/run-on-arch-action@v2.5.0
with:
arch: armv7
distro: ubuntu22.04
install: |
echo "Install packages"
apt-get update && apt-get -y install python3
run: |
echo "this step will also run but will reinstall everything"
python3 --version
- name : Check system 3 - Token only
uses: uraimo/run-on-arch-action@v2.5.0
with:
arch: armv7
distro: ubuntu22.04
githubToken: ${{ github.token }}
run: |
echo "this step will fail"
python3 --version
Hello, I was wondering if it was possible to use the same containers across multiple steps in the same jobs? Something along the line of:
The idea is to split the building chain into multiple steps so it's easier to monitor. It seems that at the moment, each steps is recreating the container at each run...