From 96467ab43256f0990ed2c48938c273b5315fdec9 Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Thu, 5 Apr 2018 15:01:34 -0700 Subject: Add docker to base system --- .gitlab-ci.yml | 367 ++----------------------------- strata/go-docker.morph | 23 ++ strata/go-docker/docker.morph | 12 + strata/go-docker/go.morph | 16 ++ systems/base-system-x86_64-generic.morph | 2 + 5 files changed, 74 insertions(+), 346 deletions(-) create mode 100644 strata/go-docker.morph create mode 100644 strata/go-docker/docker.morph create mode 100644 strata/go-docker/go.morph diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5038fa96..b99ff2f0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,358 +1,33 @@ -image: buildstream/buildstream-fedora:latest +image: debian:jessie variables: - # Store everything under the /builds directory. This is a separate Docker - # volume. Note that GitLab CI will only cache stuff inside the build - # directory. Note also that YBD recursively scans the current directory - # to find what definitions to build -- that's why we put the cache in a - # hidden directory. - XDG_CACHE_HOME: "${CI_PROJECT_DIR}/.cache" YBD_base: "/cache/ybd_base" - YBD_gits: "${CI_PROJECT_DIR}/.cache/ybd_base/gits" - DEFS2BST_SHA: '1dc5c0719de9357470b29ad4adc9b63f7012db86' - GET_SOURCES_ATTEMPTS: 3 -.ybd_before_script: &ybd_before_script - before_script: - # Install and configure YBD - - | - export SPEC_SHA='715023f3cf6e714839fb56236ade20de40855bd4' - export YBD_SHA='157986cb2f7c0b95e0e4e0bf3a39547f548a298d' - export LC_ALL="C.UTF-8" - git clone https://gitlab.com/baserock/spec.git - # Use specific version of spec.git - git -C spec checkout $SPEC_SHA - git clone https://gitlab.com/baserock/ybd.git - # Use specific version of ybd.git - git -C ybd checkout $YBD_SHA - cd ybd && ./install_dependencies.sh && cd .. - pip install -r spec/requirements.txt +before_script: +- git clone https//gitlab.com/baserock/ybd +- cd ybd +- sh ./install_dependencies.sh +- cd .. -.bst_before_script: &bst_before_script - before_script: - - | - export BST_SHA='3fd7fe1fd3406fc9c35d0d2719085809c48247c7' - export BST_EXTERNAL_SHA='90edaa55568207c55dc12268ef01998584dd7af5' - git clone https://gitlab.com/BuildStream/buildstream.git - # Use specific version of BuildStream - cd buildstream && git checkout $BST_SHA - pip3 install . - cd - - git clone https://gitlab.com/BuildStream/bst-external.git - # Use specific version of bst-external plugins - cd bst-external && git checkout $BST_EXTERNAL_SHA - pip3 install . - cd - - - # Create ~/.ssh for storing keys - - mkdir -p ~/.ssh - - # Private key stored as a protected variable that allows pushing to - # ostree@ostree.baserock.org - - | - if [ -z "$baserock_ostree_cache_private_key" ]; then - echo >&2 "Private key for ostree.baserock.org is not available." - else - echo "$baserock_ostree_cache_private_key" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub - fi - - # Trust the host key of the cache server. - - ssh-keyscan -p 22200 ostree.baserock.org >> ~/.ssh/known_hosts - - # If we can push, then enable push and pull for Baserock artifact cache - # (default config is pull only) - - | - if [ -n "$baserock_ostree_cache_private_key" ]; then - mkdir -p ~/.config - echo "projects:" > ~/.config/buildstream.conf - echo " baserock:" >> ~/.config/buildstream.conf - echo " artifacts:" >> ~/.config/buildstream.conf - echo " url: ssh://ostree@ostree.baserock.org:22200/cache" >> ~/.config/buildstream.conf - fi - cat ~/.config/buildstream.conf - - # Nuke ybd cache to ensure buildstream tasks have enough disk space. - - rm -rf "${YBD_base}" - -# Store all the downloaded git and ostree repos in the distributed cache. -# This saves us fetching them from git.baserock.org and further afield -# on every build. -.ybd_cache: &ybd_cache - cache: - # GitLab defined default key is "default". Reuse this for ybd. - key: default - paths: - - "${YBD_gits}/" -.bst_cache: &bst_cache - cache: - key: bst - paths: - - "${XDG_CACHE_HOME}/buildstream/sources/" +cache: + paths: + - "$YBD_base" stages: - - preprocess - - build-1 - - deploy-1 - - build-2 - -ybd-validate-all-definitions: - stage: preprocess - <<: *ybd_before_script - script: - - python spec/quick_check.py . - <<: *ybd_cache - -ybd-build-system-x86_64-chroot-build: - stage: build-1 - dependencies: [] - <<: *ybd_before_script - script: - - ybd/ybd.py systems/build-system-x86_64-chroot.morph x86_64 - <<: *ybd_cache - -ybd-build-system-x86_64-chroot-deploy: - stage: deploy-1 - dependencies: - - ybd-build-system-x86_64-chroot-build - <<: *ybd_before_script - script: - - ybd/ybd.py clusters/build-system-x86_64-chroot-deploy.morph x86_64 - cache: - # GitLab defined default key is "default". Reuse this for ybd. - key: default - policy: pull - paths: - - .cache/ybd_base/gits - artifacts: - name: "${CI_BUILD_NAME}-${CI_BUILD_REF}" - paths: - - build-system-x86_64-chroot.tar - -#build-system-armv7lhf-rootfs-build: -# stage: build-1 -# script: -# - sudo ybd/ybd.py systems/build-system-armv7lhf-rootfs.morph armv7lhf -# tags: -# - armv7l -# only: -# - master -# - /^staging\/.*$/ - -ybd-genivi-demo-platform-build-64: - stage: build-2 - dependencies: [] - <<: *ybd_before_script - script: - - ybd/ybd.py genivi/systems/genivi-demo-platform-x86_64-generic.morph x86_64 - - ybd/ybd.py systems/initramfs-x86_64.morph x86_64 - <<: *ybd_cache - -ybd-ivi-build-64: - stage: build-2 - dependencies: [] - <<: *ybd_before_script - script: - - ybd/ybd.py ivi/systems/ivi-system-x86_64.morph x86_64 - - ybd/ybd.py systems/initramfs-x86_64.morph x86_64 - <<: *ybd_cache - -ybd-gnome-build-64: - stage: build-2 - dependencies: [] - <<: *ybd_before_script - script: - - ybd/ybd.py gnome/systems/gnome-system-x86_64.morph x86_64 - - ybd/ybd.py systems/initramfs-x86_64.morph x86_64 - <<: *ybd_cache - -ybd-minimal-build-64: - stage: build-1 - dependencies: [] - <<: *ybd_before_script - script: - - ybd/ybd.py systems/minimal-system-x86_64-chroot.morph x86_64 - <<: *ybd_cache - -ybd-minimal-system-x86_64-chroot-deploy: - stage: deploy-1 - dependencies: - - ybd-minimal-build-64 - <<: *ybd_before_script - script: - - ybd/ybd.py clusters/minimal-system-x86_64-chroot-deploy.morph x86_64 - cache: - # GitLab defined default key is "default". Reuse this for ybd. - key: default - policy: pull - paths: - - .cache/ybd_base/gits - artifacts: - name: "${CI_BUILD_NAME}-${CI_BUILD_REF}" - paths: - - minimal-system-x86_64-chroot.tar - -ybd-trove-build-64: - stage: build-2 - dependencies: [] - <<: *ybd_before_script - script: - - ybd/ybd.py trove/systems/trove-system-x86_64.morph x86_64 - <<: *ybd_cache +- build - -########################################## -# BuildStream conversions and tests # -########################################## - -# Convert the Baserock definitions to BuildStream format -bst-convert: - stage: preprocess - <<: *bst_before_script +.build_template: &build_definition + stage: build + variables: + YBD_kbas_url: "false-url" + YBD_check_definitions: "exit" script: - # Install YBD and defs2bst - - | - if [ ! -d ./ybd ]; then - git clone https://gitlab.com/baserock/ybd.git - git -C ybd checkout $YBD_SHA - cd ybd && ./install_dependencies.sh && cd - - fi - git clone https://gitlab.com/BuildStream/defs2bst.git - git -C defs2bst checkout $DEFS2BST_SHA - echo "defs2bst version: $(git -C ./defs2bst rev-parse HEAD)" - - ./convert - artifacts: - paths: - - elements/ - <<: *ybd_cache + - ./ybd.py definitions/systems/base-system-x86_64-generic.morph x86_64 + only: + - master -# Test building the simplest Baserock system first -bst-build-minimal-system: - stage: build-1 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/minimal-system-content.bst - <<: *bst_cache +check_build_debian_stretch: + image: debian:stretch + <<: *build_definition -bst-minimal-system-deploy: - stage: deploy-1 - dependencies: - - bst-convert - - bst-build-minimal-system - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/minimal-system-image-x86_64.bst - - bst checkout systems/minimal-system-image-x86_64.bst ./minimal-system - - dnf install -y qemu-system-x86 - - scripts/test-minimal-system ./minimal-system/sda.img - <<: *bst_cache - artifacts: - name: "${CI_BUILD_NAME}-${CI_BUILD_REF}" - paths: - - ./minimal-system/sda.img - expire_in: 1 week -# Test building all converted Baserock systems -bst-build-base-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/base-system-content.bst - <<: *bst_cache - -bst-build-build-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/build-system-content.bst - <<: *bst_cache - -bst-build-genivi-demo-platform-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/genivi-demo-platform-content.bst - <<: *bst_cache - -bst-build-gnome-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/gnome-system-content.bst - <<: *bst_cache - -bst-build-ivi-demo-platform-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/ivi-system-content.bst - <<: *bst_cache - -bst-build-openstack-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/openstack-system-content.bst - <<: *bst_cache - -bst-build-trove-system: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-build-or-show systems/trove-system-content.bst - <<: *bst_cache - -# Test cross building a toolchain and sysroot for each supported non-x86_64 -# architecture. -bst-build-sysroot-armv8b64: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-cross-build-or-show armv8b64 gnu-toolchain/stage2.bst - <<: *bst_cache - -bst-build-sysroot-armv8l64: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-cross-build-or-show armv8l64 gnu-toolchain/stage2.bst - <<: *bst_cache - -bst-build-sysroot-ppc64b: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-cross-build-or-show ppc64b gnu-toolchain/stage2.bst - <<: *bst_cache - -bst-build-sysroot-ppc64l: - stage: build-2 - dependencies: - - bst-convert - <<: *bst_before_script - script: - - scripts/bst-cross-build-or-show ppc64l gnu-toolchain/stage2.bst - <<: *bst_cache diff --git a/strata/go-docker.morph b/strata/go-docker.morph new file mode 100644 index 00000000..1beddabb --- /dev/null +++ b/strata/go-docker.morph @@ -0,0 +1,23 @@ +name: go-docker +kind: stratum +build-depends: +- morph: strata/tools.morph +chunks: +- name: go + repo: upstream:go + morph: strata/go-docker/go.morph + ref: 536a6e6905993f1270f7a8b742352ce832cbf144 + unpetrify-ref: go1.3.3 + build-depends: [] +- name: docker + repo: upstream:docker + morph: strata/go-docker/docker.morph + ref: c78088fe3d1b90640c637d8c3457de3caa0c7a24 + unpetrify-ref: v1.3.0 + build-depends: + - go +- name: iptables + repo: upstream:iptables + ref: 3e6fa55d5e28c93f417afeae7a7d4f349ddffcf4 + unpetrify-ref: baserock/morph + build-depends: [] diff --git a/strata/go-docker/docker.morph b/strata/go-docker/docker.morph new file mode 100644 index 00000000..388f0144 --- /dev/null +++ b/strata/go-docker/docker.morph @@ -0,0 +1,12 @@ +name: docker +kind: chunk +build-commands: +- | + export AUTO_GOPATH=1 + export DOCKER_BUILDTAGS='exclude_graphdriver_devicemapper' + export TMPDIR=/tmp + ./hack/make.sh binary +install-commands: +- mkdir -p "$DESTDIR$PREFIX/bin" +- install -D bundles/*/binary/docker "$DESTDIR$PREFIX/bin/docker" +- install -D contrib/check-config.sh "$DESTDIR$PREFIX/bin" diff --git a/strata/go-docker/go.morph b/strata/go-docker/go.morph new file mode 100644 index 00000000..24790bd5 --- /dev/null +++ b/strata/go-docker/go.morph @@ -0,0 +1,16 @@ +name: go +kind: chunk +build-commands: +- | + export GOROOT_FINAL="$PREFIX/lib/go" + export TMPDIR=/tmp + cd src && bash ./make.bash +install-commands: +- mkdir -p "$DESTDIR$PREFIX/lib/go" +- cp -r bin "$DESTDIR$PREFIX/lib/go" +- cp -r lib "$DESTDIR$PREFIX/lib/go" +- cp -r src "$DESTDIR$PREFIX/lib/go" +- cp -r pkg "$DESTDIR$PREFIX/lib/go" +- mkdir -p "$DESTDIR$PREFIX/bin" +- ln -s "$PREFIX/lib/go/bin/go" "$DESTDIR$PREFIX/bin/go" + diff --git a/systems/base-system-x86_64-generic.morph b/systems/base-system-x86_64-generic.morph index aa1659b3..3e9e485c 100644 --- a/systems/base-system-x86_64-generic.morph +++ b/systems/base-system-x86_64-generic.morph @@ -10,6 +10,8 @@ strata: morph: strata/core.morph - name: foundation morph: strata/foundation.morph + name: go-docker + morph: strata/go-docker.morph - name: bsp-x86_64-generic morph: strata/bsp-x86_64-generic.morph configuration-extensions: -- cgit v1.2.1