diff --git a/.travis.yml b/.travis.yml index d8392a8f27..8ce1f811dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,74 @@ language: go -matrix: - include: - - os: linux - sudo: required - services: - - docker - - os: osx - go: - 1.13.x notifications: email: false -install: - # Ideally, the (brew update) should not be necessary and Travis would have fairly - # frequenstly updated OS images; that’s not been the case historically. - # In particular, explicitly unlink python@2, which has been removed from Homebrew - # since the last OS image build (as of July 2020), but the Travis OS still - # contains it, and it prevents updating of Python 3. - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew unlink python@2 && brew install gpgme ; fi - -script: - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then hack/travis_osx.sh ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make vendor && ./hack/tree_status.sh && make local-cross && make check ; fi +env: + global: + - REGISTRY=quay.io + +x_base_steps: + - &image-build-push + services: + - docker + os: linux + script: + - SOURCE_TYPE=upstream REPO=skopeo/upstream TAG=master make build-push-arch-container + - SOURCE_TYPE=stable REPO=skopeo/stable TAG=v1.2.0 EXTRA_REPO=containers/skopeo make build-push-arch-container + +stages: + - local-build + - name: image-build-push + if: type != pull_request AND branch = master + - name: multi-arch-manifest-push + if: type != pull_request AND branch = master + +jobs: + allow_failures: + - if: arch in (s390x, ppc64le) + include: + - stage: local-build + <<: *local-build + name: local build for osx + os: osx + install: + # Ideally, the (brew update) should not be necessary and Travis would have fairly + # frequently updated OS images; that's not been the case historically. + # In particular, explicitly unlink python@2, which has been removed from Homebrew + # since the last OS image build (as of July 2020), but the Travis OS still + # contains it, and it prevents updating of Python 3. + - brew update && brew unlink python@2 && brew install gpgme + script: + - hack/travis_osx.sh + - stage: local-build + <<: *local-build + name: local build for linux + os: linux + services: + - docker + script: + - make vendor && ./hack/tree_status.sh && make local-cross && make check + + - stage: image-build-push + <<: *image-build-push + name: image for amd64 + arch: amd64 + + - stage: image-build-push + <<: *image-build-push + name: image for s390x + arch: s390x + + - stage: image-build-push + <<: *image-build-push + name: image for ppc64le + arch: ppc64le + + - stage: multi-arch-manifest-push + os: linux + script: + - SOURCE_TYPE=upstream REPO=skopeo/upstream TAG=master make push-ma-manifest + - SOURCE_TYPE=stable REPO=skopeo/stable TAG=v1.2.0 EXTRA_REPO=containers/skopeo make push-ma-manifest diff --git a/Makefile b/Makefile index 00056e11a6..9d37953358 100644 --- a/Makefile +++ b/Makefile @@ -82,6 +82,14 @@ ifeq ($(DISABLE_CGO), 1) override BUILDTAGS = exclude_graphdriver_devicemapper exclude_graphdriver_btrfs containers_image_openpgp endif +ARCHES=amd64 s390x ppc64le +MA_IMAGE := $(REGISTRY)/$(REPO):$(TAG) +ARCH_IMAGE := $(MA_IMAGE)-$(GOARCH) +ifneq ($(EXTRA_REPO),) +EXTRA_MA_IMAGE := $(REGISTRY)/$(EXTRA_REPO):$(TAG) +EXTRA_ARCH_IMAGE := $(EXTRA_MA_IMAGE)-$(GOARCH) +endif + # make all DEBUG=1 # Note: Uses the -N -l go compiler options to disable compiler optimizations # and inlining. Using these build options allows you to subsequently @@ -135,6 +143,27 @@ local-cross: bin/skopeo.darwin.amd64 bin/skopeo.linux.arm bin/skopeo.linux.arm64 build-container: ${CONTAINER_RUNTIME} build ${BUILD_ARGS} -t "$(IMAGE)" . +# Build and ush container specific to arch +build-push-arch-container: + ${CONTAINER_RUNTIME} build -t "${ARCH_IMAGE}" contrib/skopeoimage/${SOURCE_TYPE} + echo "${QUAY_PASSWORD}" | ${CONTAINER_RUNTIME} login ${REGISTRY} -u "${QUAY_USERNAME}" --password-stdin + ${CONTAINER_RUNTIME} push "${ARCH_IMAGE}" +ifneq ($(EXTRA_REPO),) + ${CONTAINER_RUNTIME} tag "${ARCH_IMAGE}" "${EXTRA_ARCH_IMAGE}" + ${CONTAINER_RUNTIME} push "${EXTRA_ARCH_IMAGE}" +endif + +# Push manifest to make multi-arch image +push-ma-manifest: + echo "${QUAY_PASSWORD}" | docker login ${REGISTRY} -u "${QUAY_USERNAME}" --password-stdin + sudo chmod 0755 /etc/docker + DOCKER_CLI_EXPERIMENTAL="enabled" docker manifest create "${MA_IMAGE}" $(foreach arch,${ARCHES}, ${MA_IMAGE}-${arch}) + DOCKER_CLI_EXPERIMENTAL="enabled" docker manifest push --purge "${MA_IMAGE}" +ifneq ($(EXTRA_REPO),) + DOCKER_CLI_EXPERIMENTAL="enabled" docker manifest create "${EXTRA_MA_IMAGE}" $(foreach arch,${ARCHES}, ${EXTRA_MA_IMAGE}-${arch}) + DOCKER_CLI_EXPERIMENTAL="enabled" docker manifest push --purge "${EXTRA_MA_IMAGE}" +endif + $(MANPAGES): %: %.md sed -e 's/\((skopeo.*\.md)\)//' -e 's/\[\(skopeo.*\)\]/\1/' $< | $(GOMD2MAN) -in /dev/stdin -out $@