Skip to content

Commit

Permalink
Merge pull request #57 from WyriHaximusNet/split-all-steps-up-into-sm…
Browse files Browse the repository at this point in the history
…all-steps-per-PHP-andAlpina-version-combination

Move control of what to build to GA Workflow
  • Loading branch information
WyriHaximus authored Dec 27, 2019
2 parents 3f87bfa + feeacb9 commit fb73237
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,30 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
alpine: ['3.10']
php: [7.2, 7.3, 7.4]
type: [zts, nts]
steps:
- uses: actions/checkout@v1
- run: mkdir ./docker-image/
- run: make build-${{ matrix.type }}
- run: ./build-php.sh zts zts ${{ matrix.php }} ${{ matrix.alpine }}
if: matrix.type == 'zts'
- run: ./build-php.sh cli nts ${{ matrix.php }} ${{ matrix.alpine }}
if: matrix.type == 'nts'
- run: cat ./docker-image/build-${{ matrix.type }}.tags | xargs -I % docker inspect --format='%={{.Id}}:{{index .ContainerConfig.Env 7}}' %
- run: docker save "${DOCKER_IMAGE}" -o ./docker-image/docker_image-${{ matrix.type }}.tar
- run: docker images
- uses: actions/upload-artifact@master
with:
name: docker-image-${{ matrix.type }}
name: docker-image-${{ matrix.alpine }}-${{ matrix.php }}-${{ matrix.type }}
path: ./docker-image
scan-vulnerability:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
alpine: ['3.10']
php: [7.2, 7.3, 7.4]
type: [zts, nts]
steps:
- uses: actions/checkout@v1
Expand All @@ -52,7 +59,7 @@ jobs:
sudo chmod +x /usr/local/bin/clair-scanner
- uses: actions/download-artifact@master
with:
name: docker-image-${{ matrix.type }}
name: docker-image-${{ matrix.alpine }}-${{ matrix.php }}-${{ matrix.type }}
path: ./docker-image
- run: docker load --input ./docker-image/docker_image-${{ matrix.type }}.tar
- run: mkdir -p "./clair/${DOCKER_IMAGE}"
Expand All @@ -62,13 +69,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
alpine: ['3.10']
php: [7.2, 7.3, 7.4]
type: [zts, nts]
steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@master
with:
name: docker-image-${{ matrix.type }}
name: docker-image-${{ matrix.alpine }}-${{ matrix.php }}-${{ matrix.type }}
path: ./docker-image
- run: ls -lasth ./docker-image
- run: docker load --input ./docker-image/docker_image-${{ matrix.type }}.tar
- run: make test-${{ matrix.type }}
- run: rm -Rf ./docker-image/
Expand All @@ -79,14 +89,16 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
alpine: ['3.10']
php: [7.2, 7.3, 7.4]
type: [zts, nts]
steps:
- uses: actions/checkout@v1
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master'
- uses: actions/download-artifact@master
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master'
with:
name: docker-image-${{ matrix.type }}
name: docker-image-${{ matrix.alpine }}-${{ matrix.php }}-${{ matrix.type }}
path: ./docker-image
- run: docker load --input ./docker-image/docker_image-${{ matrix.type }}.tar
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.ref == 'refs/heads/master'
Expand Down
17 changes: 2 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,6 @@ current_dir := $(abspath $(patsubst %/,%,$(dir $(mkfile_path))))

BUILDINGIMAGE=*

# Docker PHP images build matrix ./build-php.sh (nts/zts) (PHP version) (Alpine version)
build-nts: BUILDINGIMAGE=nts
build-nts: clean-tags
./build-php.sh cli nts 7.2 3.10
./build-php.sh cli nts 7.3 3.10
./build-php.sh cli nts 7.4 3.10

build-zts: BUILDINGIMAGE=zts
build-zts: clean-tags
./build-php.sh zts zts 7.2 3.10
./build-php.sh zts zts 7.3 3.10
./build-php.sh zts zts 7.4 3.10

.NOTPARALLEL: clean-tags
clean-tags:
rm ${current_dir}/docker-image/build-${BUILDINGIMAGE}.tags || true
Expand Down Expand Up @@ -54,13 +41,13 @@ test-zts: ./docker-image/build-zts.tags

scan-vulnerability:
docker-compose -f test/security/docker-compose.yml -p clair-ci up -d
RETRIES=0 && while ! wget -T 10 -q -O /dev/null http://localhost:6060/v1/namespaces ; do sleep 1 ; echo -n "." ; if [ $${RETRIES} -eq 10 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; RETRIES=$$(($${RETRIES}+1)) ; done
RETRIES=0 && while ! wget -T 10 -q -O /dev/null http://localhost:6060/v1/namespaces ; do sleep 1 ; echo -n "." ; if [ $${RETRIES} -eq 60 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; RETRIES=$$(($${RETRIES}+1)) ; done
cat ./docker-image/build-*.tags | xargs -I % sh -c 'clair-scanner --ip 172.17.0.1 -r "./docker-imageclair/%.json" -l ./clair/clair.log % || echo "% is vulnerable"'
docker-compose -f test/security/docker-compose.yml -p clair-ci down

ci-scan-vulnerability:
docker-compose -f test/security/docker-compose.yml -p clair-ci up -d
RETRIES=0 && while ! wget -T 10 -q -O /dev/null http://localhost:6060/v1/namespaces ; do sleep 1 ; echo -n "." ; if [ $${RETRIES} -eq 10 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; RETRIES=$$(($${RETRIES}+1)) ; done
RETRIES=0 && while ! wget -T 10 -q -O /dev/null http://localhost:6060/v1/namespaces ; do sleep 1 ; echo -n "." ; if [ $${RETRIES} -eq 60 ] ; then echo " Timeout, aborting." ; exit 1 ; fi ; RETRIES=$$(($${RETRIES}+1)) ; done
cat ./docker-image/build-*.tags | xargs -I % sh -c 'clair-scanner --ip 172.17.0.1 -r "./clair/%.json" -l ./clair/clair.log %'; \
XARGS_EXIT=$$?; \
if [ $${XARGS_EXIT} -eq 123 ]; then find ./clair/wyrihaximusnet -type f | sed 's/^/-Fjson=@/' | xargs -d'\n' curl -X POST ${WALLE_REPORT_URL} -F channel=team_oz -F buildUrl=https://circleci.com/gh/wyrihaximusnet/docker-php/${CIRCLE_BUILD_NUM}#artifacts/containers/0; else exit $${XARGS_EXIT}; fi

0 comments on commit fb73237

Please sign in to comment.