File tree Expand file tree Collapse file tree 5 files changed +28
-49
lines changed
Expand file tree Collapse file tree 5 files changed +28
-49
lines changed Original file line number Diff line number Diff line change 55 branches :
66 - main
77 schedule :
8- - cron : " 0 5 * * * "
8+ - cron : " 0 1 * * 1 "
99
1010jobs :
1111 build :
12- name : Build Container
12+ name : Build and Push Container
1313 runs-on : ubuntu-latest
1414 strategy :
1515 matrix :
2121 -
2222 name : Docker info
2323 run : docker info
24- -
25- name : Docker Builder
26- run : docker buildx ls
2724 -
2825 name : Set up QEMU
2926 uses : docker/setup-qemu-action@v3
@@ -32,23 +29,25 @@ jobs:
3229 uses : docker/setup-buildx-action@v3
3330 with :
3431 platforms : linux/amd64,linux/arm64
35- - name : Setup BATS
32+ -
33+ name : Setup BATS
3634 uses : mig4/setup-bats@v1
3735 with :
38- bats-version : 1.2.1
39-
40- - name : Check out code
36+ bats-version : 1.11.0
37+ -
38+ name : Check out code
4139 uses : actions/checkout@v1
42-
43- - name : " Test ddev ${{ matrix.version }} image"
40+ -
41+ name : " Test ddev ${{ matrix.version }} image"
4442 shell : ' script -q -e -c "bash {0}"'
4543 run : |
44+ sudo snap install yq
4645 ./build.sh -v ${{ matrix.version }} -l
4746 DDEV_VERSION=${{ matrix.version }} bash bats tests
4847 -
49- name : " ddev ${{ matrix.version }}"
48+ name : " Build ddev ${{ matrix.version }} multi-arch image "
5049 shell : ' script -q -e -c "bash {0}"'
5150 run : |
5251 echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
5352 docker buildx create --use --platform=linux/arm64,linux/amd64
54- ./build.sh -v ${{ matrix.version }} -p
53+ ./build.sh -v ${{ matrix.version }} -x - p
Original file line number Diff line number Diff line change 88 - ' !main'
99jobs :
1010 build :
11- name : Build Container
11+ name : Build and Test Container
1212 runs-on : ubuntu-latest
1313 strategy :
1414 matrix :
2020 -
2121 name : Docker info
2222 run : docker info
23- -
24- name : Docker Builder
25- run : docker buildx ls
2623 -
2724 name : Set up QEMU
2825 uses : docker/setup-qemu-action@v3
3128 uses : docker/setup-buildx-action@v3
3229 with :
3330 platforms : linux/amd64,linux/arm64
34- -
35- name : Setup yq
36- uses : mikefarah/yq@master
3731 -
3832 name : Setup BATS
3933 uses : mig4/setup-bats@v1
4640 name : " Test ddev ${{ matrix.version }} image"
4741 shell : ' script -q -e -c "bash {0}"'
4842 run : |
43+ sudo snap install yq
4944 ./build.sh -v ${{ matrix.version }} -l
5045 DDEV_VERSION=${{ matrix.version }} bash bats tests
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ Available options:
1717 * v - DDEV version e.g. 'v1.23.1'
1818 * l - Load the image (--load)
1919 * p - Push the image (--push)
20+ * x - Build multi-arch image (--platform linux/amd64,linux/arm64)
2021
2122## Version to tags
2223
@@ -27,26 +28,11 @@ Available options:
2728| ./build.sh -v v1.23 | v1.23, v1.23.x (latest bugfix) |
2829| ... | ... |
2930
31+ ## Run tests locally
3032
31- ## TEST
33+ Requires [ bats-core ] ( https://bats-core.readthedocs.io/en/stable/installation.html ) and [ yq ] ( https://github.com/mikefarah/yq/tree/v4.44.2?tab=readme-ov-file#install ) .
3234
33- Any good to disable TLS?!
34-
35- ``` bash
36- NETWORK=" ddev-docker"
37- if docker network inspect " $NETWORK " & > /dev/null; then
38- echo " Network '$NETWORK ' already exists."
39- else
40- echo " Creating network '$NETWORK '."
41- docker network create " $NETWORK "
42- fi
43-
44- # Get DinD ready - need privileged mode?!?!?
45- # WORKING::: docker run --privileged -e DOCKER_TLS_CERTDIR="" --name ddev-dind -d --network ddev-docker --network-alias docker docker:dind
46- docker run --privileged -e DOCKER_TLS_CERTDIR=" " --name ddev-dind -d --network ddev-docker --network-alias docker docker:dind-rootless
47-
48- # Wait till DinD is ready
49-
50- # Run ddev/docker related commands - - -e DOCKER_HOST="tcp://docker:2375/"
51- docker run --rm -it --network ddev-docker ghcr.io/ochorocho/ddev-gitlab-ci:v1.23.3 version
5235```
36+ DDEV_VERSION=v1.23.3 bash bats tests
37+ ```
38+
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ help() {
1515 echo " * v - DDEV version e.g. 'v1.23.1'"
1616 echo " * l - Load the image (--load)"
1717 echo " * p - Push the image (--push)"
18+ echo " * x - Build multi-arch image (--platform linux/amd64,linux/arm64)"
1819}
1920
2021loadVersionAndTags () {
@@ -49,7 +50,7 @@ loadVersionAndTags() {
4950 fi
5051}
5152
52- while getopts " :v:hpl " opt; do
53+ while getopts " :v:hplx " opt; do
5354 case $opt in
5455 h)
5556 help
@@ -64,6 +65,9 @@ while getopts ":v:hpl" opt; do
6465 l)
6566 LOAD=" --load"
6667 ;;
68+ x)
69+ PLATFORM=" --platform linux/amd64,linux/arm64"
70+ ;;
6771 * )
6872 echo " Invalid option: -$OPTARG "
6973 help
7478
7579loadVersionAndTags
7680
77- docker buildx build --platform linux/amd64,linux/arm64 --progress plain --no-cache --pull . -f Dockerfile ${DOCKER_TAGS[@]} --build-arg ddev_version=" $DDEV_VERSION " $PUSH $LOAD
78-
79- if [ $LOAD ]; then
80- docker run --rm -it -v " $( pwd) /test.sh:/tmp/test.sh" --entrypoint " ash" " $IMAGE_NAME :$DDEV_VERSION " /tmp/test.sh
81- fi
82-
81+ docker buildx build ${PLATFORM} --progress plain --no-cache --pull . -f Dockerfile ${DOCKER_TAGS[@]} --build-arg ddev_version=" $DDEV_VERSION " $PUSH $LOAD
Original file line number Diff line number Diff line change 1313@test " See ddev version" {
1414 run docker-run " ddev version -j"
1515
16- version=$( echo " $output " | head -2 | tail -1 | yq ' .raw.["DDEV version"]' )
16+ version=$( echo " $output " | tail -n 1 | yq ' .raw.["DDEV version"]' )
1717 regex=' ^v([0-9]+)\.([0-9]+)\.([0-9]+)$'
1818
1919 [[ $version =~ $regex ]]
7171
7272docker-run () {
7373 local COMMAND=${1}
74- # @todo: Pass in the current version
74+
7575 docker run --rm -it --network ddev-docker ghcr.io/ochorocho/ddev-gitlab-ci:" ${DDEV_VERSION} " /bin/sh -c " ${COMMAND} "
7676}
You can’t perform that action at this time.
0 commit comments