Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify image naming and packaging #690

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
language: __sardonyx__

dist: xenial
group: edge

services:
- postgresql

filter_secrets: false

cache:
bundler: true
directories:
- ${HOME}/bin

env:
matrix:
- TRAVIS_JOB_BOARD_REGISTER_YML="${TRAVIS_BUILD_DIR}/.example-job-board-register-sardonyx.yml"
Expand All @@ -23,6 +27,7 @@ env:
- SPEC_RUNNER='bash -lc'
- SPEC_SUITES='travis_packer_templates'
- SYSTEM_INFO_JSON="${TRAVIS_BUILD_DIR}/.example_system_info.json"

install:
- if [[ -f .test-branch ]]; then
export TRAVIS_COOKBOOKS_TEST_BRANCH="$(cat .test-branch 2>/dev/null)";
Expand All @@ -37,7 +42,6 @@ install:
script:
- make
- bundle exec make test
- make update-gce-images
- git diff --exit-code
- git diff --cached --exit-code
- sudo lsof | grep dpkg || true
Expand All @@ -46,12 +50,14 @@ script:
echo "checking $f";
jq . < $f &>/dev/null;
done

after_success:
- if [[ $TRAVIS_JOB_BOARD_REGISTER_YML =~ sardonyx ]]; then
git fetch --unshallow;
bundle exec make packer-build-trigger;
else
echo 'no packer-build-trigger for you';
fi

notifications:
email: false
61 changes: 0 additions & 61 deletions bin/gce-image-update

This file was deleted.

2 changes: 1 addition & 1 deletion ci-opal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ builders:
image_description: Travis CI opal
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image: ubuntu-1604-xenial-v20181023
source_image_family: ubuntu-1604-lts
zone: us-central1-a
image_name: "{{ user `image_name` }}"
machine_type: n1-standard-4
Expand Down
2 changes: 1 addition & 1 deletion ci-sardonyx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ builders:
image_description: Travis CI sardonyx
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image: ubuntu-1604-xenial-v20181023
source_image_family: ubuntu-1604-lts
zone: us-central1-a
image_name: "{{ user `image_name` }}"
machine_type: n1-standard-4
Expand Down
2 changes: 1 addition & 1 deletion ci-stevonnie.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ builders:
image_description: Travis CI stevonnie
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image: ubuntu-1604-xenial-v20181023
source_image_family: ubuntu-1604-lts
zone: us-central1-a
image_name: "{{ user `image_name` }}"
machine_type: n1-standard-4
Expand Down
205 changes: 205 additions & 0 deletions ci-ubuntu-1404.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
---
description: Travis CI Ubuntu 14.04 build environment template
variables:
docker_repository: travisci/ci-ubuntu-1404
docker_tag: packer-{{ timestamp }}-<%= git_desc %>
gce_account_file: "{{ env `GCE_ACCOUNT_FILE` }}"
gce_project_id: "{{ env `GCE_PROJECT_ID` }}"
image_name: travis-ci-ubuntu-1404-{{ timestamp }}-<%= git_desc %>
image_family: travis-ci-ubuntu-1404-edge
openstack_source_image_name: "{{ env `OS_SOURCE_IMAGE_XENIAL` }}"
travis_cookbooks_branch: trusty-stable
travis_cookbooks_edge_branch: master
travis_cookbooks_sha: "{{ env `TRAVIS_COOKBOOKS_SHA` }}"
travis_uid: "{{ env `TRAVIS_UID` }}"
github_token: "{{ env `GITHUB_NOSCOPE_TOKEN` }}"
openstack_zone: "{{ env `OS_ZONE` }}"
openstack_key_path: "{{ env `OS_SSH_KEY_PATH`}}"
openstack_key_name: "{{ env `OS_SSH_KEY` }}"
builders:
- type: googlecompute
name: googlecompute
communicator: ssh
ssh_timeout: 10m
ssh_port: 22
ssh_username: packer
image_description: Travis CI Ubuntu 14.04
account_file: "{{ user `gce_account_file` }}"
project_id: "{{ user `gce_project_id` }}"
source_image_family: ubuntu-1404-lts
image_licenses: ["projects/vm-options/global/licenses/enable-vmx"]
zone: us-central1-a
image_name: "{{ user `image_name` }}"
image_family: "{{ user `image_family` }}"
machine_type: n1-standard-4
disk_size: 20
tags:
- ci
- ubuntu-1404
- travis-ci-packer-templates
- type: docker
name: docker
ssh_pty: true
<% if RUBY_PLATFORM =~ /powerpc64/ %>
image: "travisci/gce-parity:14.04-ppc64le"
<% else %>
image: "travisci/gce-parity:14.04"
<% end %>
run_command:
- -d
- -v
- <%= Dir.pwd %>/tmp/packer-builder-tmp:/tmp
- --privileged=true
- --storage-opt=size=15G
- "{{ .Image }}"
- /sbin/init
commit: true
# Openstack builds disabled for failing with an error that's not possible to debug
# until a fix for the Packer error reporting is released:
# https://github.com/travis-ci/packer-templates/issues/555
- type: openstack
name: openstack
flavor: m1.large
insecure: true
image_name: "{{ user `image_name` }}"
ssh_username: ubuntu
networks:
<% ENV['OS_NETWORKS'].to_s.split(',').map(&:strip).each do |network| %>
- <%= network %>
<% end %>
source_image_name: "{{ user `openstack_source_image_name` }}"
availability_zone: "{{ user `openstack_zone` }}"
ssh_keypair_name: "{{ user `openstack_key_name` }}"
ssh_private_key_file: "{{ user `openstack_key_path` }}"
provisioners:
- type: shell
inline: sleep 10
only:
- googlecompute
- type: shell
inline: apt-get update -yqq && apt-get install sudo -yqq
# Delay script execution until after /sbin/init has cleared out /tmp,
# otherwise the uploaded script gets deleted before it can be run.
# TODO: Decide if the container startup command should be /bin/bash and the
# /sbin/init call made the first provision step instead of this workaround:
# https://github.com/travis-ci/packer-templates/issues/544#issuecomment-344971947
pause_before: 5s
only:
- docker
- type: file
source: tmp/git-meta
destination: /var/tmp/git-meta
- type: file
source: packer-assets/ubuntu-1404-normal-purge.txt
destination: /var/tmp/purge.txt
- type: file
source: packer-assets/ubuntu-1404-ci-packages.txt
destination: /var/tmp/packages.txt
only:
- googlecompute
- openstack
- type: file
source: packer-assets/ubuntu-xenial-ci-sardonyx-docker-packages.txt
destination: /var/tmp/packages.txt
only:
- docker
- type: shell
scripts:
- packer-scripts/packer-env-dump
execute_command: "{{ .Vars }} exec sudo -E -S bash '{{ .Path }}'"
- type: shell
scripts:
- packer-scripts/remove-default-users
execute_command: "{{ .Vars }} exec sudo -E -S bash '{{ .Path }}'"
only:
- docker
- googlecompute
- type: shell
scripts:
- packer-scripts/pre-chef-bootstrap
- packer-scripts/clone-travis-cookbooks
environment_vars:
- SKIP_APT_UPGRADE=1
- TRAVIS_COOKBOOKS_BRANCH={{ user `travis_cookbooks_branch` }}
- TRAVIS_COOKBOOKS_SHA={{ user `travis_cookbooks_sha` }}
- TRAVIS_UID={{ user `travis_uid` }}
execute_command: "{{ .Vars }} exec sudo -E -S bash '{{ .Path }}'"
- type: file
source: packer-assets/ubuntu-1404-system-info-commands.yml
destination: /var/tmp/ubuntu-1404-system-info-commands.yml
- type: shell
inline: chmod 0644 /var/tmp/ubuntu-1404-system-info-commands.yml
- type: chef-solo
version: 13.8.5
config_template: chef-solo.rb.tmpl
<% if ENV['CHEF_PROFILING'] %>
execute_command: "{{if .Sudo}}sudo {{end}}CI=yes chef-solo -F doc --no-color -c {{.ConfigPath}} -j {{.JsonPath}}"
<% end %>
cookbook_paths:
- cookbooks
<% if ENV['COOKBOOKS_LOCAL'] && ENV['TRAVIS_COOKBOOKS_DIR'] %>
- <%= ENV['TRAVIS_COOKBOOKS_DIR'] %>/cookbooks
- <%= ENV['TRAVIS_COOKBOOKS_DIR'] %>/community-cookbooks
<% else %>
remote_cookbook_paths:
- /tmp/chef-stuff/travis-cookbooks/cookbooks
- /tmp/chef-stuff/travis-cookbooks/community-cookbooks
<% end %>
json:
travis_packer_build:
github_token: "{{ user `github_token` }}"
run_list:
- recipe[travis_ci_ubuntu_1404]
<% if ENV['CHEF_PROFILING'] %>
- recipe[poise-profiler]
<% end %>
- type: shell
scripts:
- packer-scripts/ensure-travis-user
- packer-scripts/purge
- packer-scripts/disable-apparmor
- packer-scripts/run-serverspecs
- packer-scripts/test-system-info-output
- packer-scripts/dump-dpkg-manifest
- packer-scripts/create-bin-lib-checksums
- packer-scripts/cleanup
# - packer-scripts/minimize
environment_vars:
- DISPLAY=:99.0
- SPEC_SUITES=travis_packer_templates
- TRAVIS_OBFUSCATE_PASSWORD=1
- TRAVIS_UID={{ user `travis_uid` }}
execute_command: "{{ .Vars }} exec sudo -E -S bash '{{ .Path }}'"
- type: shell
scripts:
- packer-scripts/create-image-metadata-tarball
environment_vars:
- IMAGE_METADATA_TARBALL=/var/tmp/image-metadata-{{ user `image_name` }}.tar.bz2
execute_command: "{{ .Vars }} exec sudo -E -S bash '{{ .Path }}'"
- type: file
source: /var/tmp/image-metadata-{{ user `image_name` }}.tar.bz2
destination: tmp/image-metadata-{{ user `image_name` }}.tar.bz2
direction: download
post-processors:
-
- type: docker-tag
repository: "{{ user `docker_repository` }}"
tag: "{{ user `docker_tag` }}"
only:
- docker
- type: shell-local
scripts: bin/docker-push
environment_vars:
- DOCKER_DEST={{ user `docker_repository` }}:{{ user `docker_tag` }}
only:
- docker
-
- type: shell-local
script: bin/job-board-register
environment_vars:
- IMAGE_NAME={{ user `docker_repository` }}:{{ user `docker_tag` }}
only:
- docker
-
- type: shell-local
script: bin/write-latest-image-name
Loading