Skip to content
Snippets Groups Projects
Commit 89817322 authored by Balasankar C's avatar Balasankar C Committed by Marin Jankovski
Browse files

Get deb package using CI API to decrease triggered docker image size

parent 444a5f68
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -272,12 +272,14 @@ Trigger:package:
stage: trigger-package
script:
- make test_no_sync
# Renaming so we can easily generate the artifact URL
- mv pkg/ubuntu-16.04/*.deb pkg/ubuntu-16.04/gitlab.deb
only:
- triggers@gitlab-org/omnibus-gitlab
artifacts:
expire_in: 1 day
paths:
- pkg/ubuntu-16.04/*.deb
- pkg/ubuntu-16.04/gitlab.deb
 
Trigger:docker:
image: "registry.gitlab.com/gitlab-org/gitlab-omnibus-builder:ruby_docker-${BUILDER_IMAGE_REVISION}"
Loading
Loading
@@ -288,7 +290,6 @@ Trigger:docker:
services:
- docker:dind
script:
- cp pkg/ubuntu-16.04/*deb docker/assets/gitlab.deb
- make docker_trigger_build_and_push
only:
- triggers@gitlab-org/omnibus-gitlab
Loading
Loading
Loading
Loading
@@ -113,10 +113,8 @@ docker_trigger_build_and_push:
echo PACKAGECLOUD_REPO=$(PACKAGECLOUD_REPO) > docker/RELEASE
echo RELEASE_PACKAGE=$(RELEASE_PACKAGE) >> docker/RELEASE
echo RELEASE_VERSION=$(RELEASE_VERSION) >> docker/RELEASE
# Our regular Docker image creation involves installing GitLab package from
# AWS bucket. Triggered ones have a package locally available and should use
# that. So, replacing the downloading command with a local install one.
sed -i "s/wget.*/dpkg -i \/assets\/gitlab.deb \&\& rm \/assets\/gitlab.deb/" docker/assets/setup
echo DOWNLOAD_URL=$(shell bundle exec support/triggered_package.rb) >> docker/RELEASE
@echo TRIGGER_PRIVATE_TOKEN=$(TRIGGER_PRIVATE_TOKEN) >> docker/RELEASE
bundle exec rake docker:build[$(RELEASE_PACKAGE)]
# While triggering from omnibus repo in .com, we explicitly pass IMAGE_TAG
# variable, which will be used to tag the final Docker image.
Loading
Loading
#!/bin/bash
if [[ ${DOWNLOAD_URL} == *"amazonaws"* ]]; then
echo "Downloading package from Amazon bucket - ${DOWNLOAD_URL}"
wget ${DOWNLOAD_URL} -O /tmp/gitlab.deb
else
echo "Downloading package as artifact - ${DOWNLOAD_URL}"
# If we are fetching the package which is available as an artifact, we need
# to authenticate to access it. Hence, we pass PRIVATE-TOKEN header.
wget --header "PRIVATE-TOKEN: ${TRIGGER_PRIVATE_TOKEN}" ${DOWNLOAD_URL} -O /tmp/gitlab.deb
fi
#!/bin/bash
 
set -xe
source /etc/lsb-release
source /RELEASE
 
# Install GitLab
wget ${DOWNLOAD_URL} -O /tmp/gitlab.deb && dpkg -i /tmp/gitlab.deb && rm /tmp/gitlab.deb
DOWNLOAD_URL=${DOWNLOAD_URL} TRIGGER_PRIVATE_TOKEN=${TRIGGER_PRIVATE_TOKEN} /assets/download-package && dpkg -i /tmp/gitlab.deb && rm /tmp/gitlab.deb
rm -rf /var/lib/apt/lists/*
 
# Create sshd daemon
Loading
Loading
#!/usr/bin/env ruby
require 'net/http'
require 'json'
uri=URI("https://gitlab.com/api/v4/projects/#{ENV['CI_PROJECT_ID']}/pipelines/#{ENV['CI_PIPELINE_ID']}/jobs")
req = Net::HTTP::Get.new(uri)
req['PRIVATE-TOKEN'] = ENV["TRIGGER_PRIVATE_TOKEN"]
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl=true
res = http.request(req)
output = JSON.parse(res.body)
id = output.find {|job| job['name'] == 'Trigger:package'}['id']
puts "#{ENV['CI_PROJECT_URL']}/builds/#{id}/artifacts/file/pkg/ubuntu-16.04/gitlab.deb"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment