parent
							
								
									e2ee31405d
								
							
						
					
					
						commit
						9886800868
					
				|  | @ -0,0 +1,39 @@ | ||||||
|  | name: e2e | ||||||
|  | 
 | ||||||
|  | on: | ||||||
|  |   push: | ||||||
|  |     branches: | ||||||
|  |       - main | ||||||
|  |   pull_request: | ||||||
|  |     branches: | ||||||
|  |       - main | ||||||
|  | 
 | ||||||
|  | jobs: | ||||||
|  |   run: | ||||||
|  |     runs-on: ubuntu-latest | ||||||
|  |     steps: | ||||||
|  |       - name: set up docker | ||||||
|  |         uses: docker-practice/actions-setup-docker@0.0.1 | ||||||
|  |         with: | ||||||
|  |           docker_version: 18.09 | ||||||
|  |           docker_channel: stable | ||||||
|  | 
 | ||||||
|  |       - name: checkout distribution | ||||||
|  |         uses: actions/checkout@master | ||||||
|  |         with: | ||||||
|  |           path: main | ||||||
|  | 
 | ||||||
|  |       - name: start distribution server | ||||||
|  |         run: | | ||||||
|  |           IP=`hostname -I | awk '{print $1}'` | ||||||
|  |           echo "IP=$IP" >> $GITHUB_ENV | ||||||
|  |           echo '{"insecure-registries" : ["'$IP':5000"]}' | sudo tee /etc/docker/daemon.json | ||||||
|  |           sudo service docker restart | ||||||
|  |           DISTRIBUTION_REF="local-distribution:v$(date +%Y%m%d%H%M%S)" | ||||||
|  |           cd ./main | ||||||
|  |           docker build -f ./Dockerfile -t "${DISTRIBUTION_REF}" . | ||||||
|  |           docker run --rm -p 5000:5000 -p 5001:5001 -idt "${DISTRIBUTION_REF}" | ||||||
|  | 
 | ||||||
|  |       - name: script | ||||||
|  |         run: | | ||||||
|  |           bash ./main/tests/push.sh $IP | ||||||
|  | @ -2,7 +2,7 @@ ARG GO_VERSION=1.13.8 | ||||||
| 
 | 
 | ||||||
| FROM golang:${GO_VERSION}-alpine3.11 AS build | FROM golang:${GO_VERSION}-alpine3.11 AS build | ||||||
| 
 | 
 | ||||||
| ENV DISTRIBUTION_DIR /go/src/github.com/docker/distribution | ENV DISTRIBUTION_DIR /go/src/github.com/distribution/distribution | ||||||
| ENV BUILDTAGS include_oss include_gcs | ENV BUILDTAGS include_oss include_gcs | ||||||
| 
 | 
 | ||||||
| ARG GOOS=linux | ARG GOOS=linux | ||||||
|  | @ -24,7 +24,7 @@ RUN set -ex \ | ||||||
|     && apk add --no-cache ca-certificates apache2-utils |     && apk add --no-cache ca-certificates apache2-utils | ||||||
| 
 | 
 | ||||||
| COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml | COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml | ||||||
| COPY --from=build /go/src/github.com/docker/distribution/bin/registry /bin/registry | COPY --from=build /go/src/github.com/distribution/distribution/bin/registry /bin/registry | ||||||
| VOLUME ["/var/lib/registry"] | VOLUME ["/var/lib/registry"] | ||||||
| EXPOSE 5000 | EXPOSE 5000 | ||||||
| ENTRYPOINT ["registry"] | ENTRYPOINT ["registry"] | ||||||
|  |  | ||||||
|  | @ -0,0 +1,26 @@ | ||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | set +e | ||||||
|  | 
 | ||||||
|  | TIMEOUT=5 | ||||||
|  | while [ $TIMEOUT -gt 0 ]; do | ||||||
|  |     STATUS=$(curl --insecure -s -o /dev/null -w '%{http_code}' http://localhost:5001/debug/health) | ||||||
|  |     echo $STATUS | ||||||
|  |     if [ $STATUS -eq 200 ]; then | ||||||
|  | 		    break | ||||||
|  |     fi | ||||||
|  |     TIMEOUT=$(($TIMEOUT - 1)) | ||||||
|  |     sleep 5 | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | if [ $TIMEOUT -eq 0 ]; then | ||||||
|  |     echo "Distribution cannot be available within one minute." | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | docker pull hello-world:latest | ||||||
|  | docker tag hello-world:latest $1:5000/distribution/hello-world:latest | ||||||
|  | docker push $1:5000/distribution/hello-world:latest | ||||||
|  | docker pull $1:5000/distribution/hello-world:latest | ||||||
		Loading…
	
		Reference in New Issue