The following is my actions file.
name: ZAP
on: push
jobs:
build:
runs-on: ubuntu-latest
container:
image: owasp/zap2docker-stable
options: --user root
volumes:
- /__w/actions-test-repo/actions-test-repo:/zap/wrk/
steps:
- uses: actions/checkout@v1
- name: view file
run: pwd
- name: run zap
if: always()
run: zap-baseline.py -t https://www.example.com -g gen.conf -r testreport.html
- name: view file
if: always()
run: pwd
I want to bind the directory /zap/wrk/ to a local directory. But when the container starts it does not mount this volume. I got the present working directory and mounted it to the docker container. Is this the correct way to do it?
Results link: https://github.com/sshniro/actions-test-repo/commit/08c0257d92b772a1d33c0b68cb8af99afdef9130/checks?check_suite_id=324032091
Similar issues have been identified in this forum as well. https://github.community/t5/GitHub-Actions/Container-volumes-key-not-mounting-volume/td-p/34798
The workaround is to use the options parameter.
name: ZAP
on: push
jobs:
build:
runs-on: ubuntu-latest
container:
image: owasp/zap2docker-stable
options: -v /__w/actions-test-repo/actions-test-repo:/zap/wrk/:rw
steps:
- uses: actions/checkout@v2
- name: run zap
if: always()
run: zap-baseline.py -t https://www.example.com -g gen.conf -w testreport.md