@@ -11,10 +11,6 @@ inputs:
1111 cmd :
1212 description : ' Command to run in the OSEDA container'
1313 required : true
14- image_file_name :
15- description : ' Name of the artifact to download (default: oseda-image)'
16- required : false
17- default : ' oseda-image'
1814 service_name :
1915 description : ' Name of the Docker service (default: from ./docker-compose.yml)'
2016 required : false
@@ -26,50 +22,40 @@ runs:
2622 - name : Set up Docker environment
2723 shell : bash
2824 run : |
29- echo "UID=$(id -u)" >> $GITHUB_ENV
30- echo "GID=$(id -g)" >> $GITHUB_ENV
25+ echo "UID=$(id -u)" >> " $GITHUB_ENV"
26+ echo "GID=$(id -g)" >> " $GITHUB_ENV"
3127
3228 - name : Get image name from docker-compose
3329 id : get-image
3430 shell : bash
3531 run : |
3632 IMAGE=$(docker compose config | awk '/image:/{print $2}' | head -n 1)
3733 if [ -z "$IMAGE" ]; then
38- echo "ERROR: No image found in docker-compose.yml"
34+ echo "[ ERROR] No image found in docker-compose.yml"
3935 exit 1
4036 fi
41- echo "IMAGE_NAME=$IMAGE" >> $GITHUB_ENV
42-
43- - name : Download Docker image from cache
44- continue-on-error : true
45- uses : actions/cache/restore@v4
46- with :
47- key : oseda-${{ env.IMAGE_NAME }}
48- path : /tmp/oseda.tar.gz
37+ echo "IMAGE_NAME=$IMAGE" >> "$GITHUB_ENV"
4938
50- - name : Load or pull Docker image
39+ - name : Pull Docker image
5140 shell : bash
5241 run : |
53- if [ -f "/tmp/oseda.tar.gz" ]; then
54- docker import /tmp/oseda.tar.gz
55- echo "Loaded image $IMAGE_NAME from artifacts/cache"
56- else
57- docker compose pull
58- fi
42+ docker compose pull
5943
6044 - name : Determine service name if not provided
6145 shell : bash
6246 run : |
6347 if [ -z "${{ inputs.service_name }}" ]; then
6448 SERVICE_NAME=$(docker compose config --services | head -n 1)
65- echo "service_name=$SERVICE_NAME" >> $GITHUB_ENV
49+ echo "service_name=$SERVICE_NAME" >> " $GITHUB_ENV"
6650 else
67- echo "service_name=${{ inputs.service_name }}" >> $GITHUB_ENV
51+ echo "service_name=${{ inputs.service_name }}" >> " $GITHUB_ENV"
6852 fi
6953
7054 - name : Run commands in OSEDA container
7155 shell : bash
7256 run : |
73- docker compose up -d
74- docker compose exec ${{ env.service_name }} bash -c "source ~/.bashrc; ${{ inputs.cmd }}" | tee result.log
75- echo "result_log=$(pwd)/result.log" >> $GITHUB_ENV
57+ # Avoid extra pulls now that we've already pulled
58+ docker compose up -d --pull=never
59+ docker compose exec -T "${{ env.service_name }}" \
60+ bash -lc "source ~/.bashrc; ${{ inputs.cmd }}" | tee result.log
61+ echo "result_log=$(pwd)/result.log" >> "$GITHUB_ENV"
0 commit comments