Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
[content] Add step to create downstream content repo
Browse files Browse the repository at this point in the history
Also, generalize its creation so it can use more content providers
besides Koji.

Signed-off-by: Alex Jaramillo <[email protected]>
  • Loading branch information
mbelluzzo-intel committed Oct 5, 2018
1 parent 72140e5 commit 0fdee7a
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $(STEPS): ${BUILD_DIR} ${STAGING_DIR}
release/$@.sh

.NOTPARALLEL: release
release: prologue koji mixer images stage
release: prologue koji content mixer images stage

.PHONY: serve
serve: ${STAGING_DIR}
Expand Down
4 changes: 3 additions & 1 deletion globals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# Servers
CLR_PUBLIC_DL_URL=${CLR_PUBLIC_DL_URL:-"https://download.clearlinux.org"}

# Variables Cache
# Workspace
VARS_DIR="${WORK_DIR:-$PWD}/.vars"
REPO_DIR="${WORK_DIR:-$PWD}/repo"
PKGS_DIR="${REPO_DIR}/x86_64/os/packages"

MIX_INCREMENT=${MIX_INCREMENT:-10}

Expand Down
1 change: 1 addition & 0 deletions release/ReleasePipeline
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pipeline {
stage('Setup Content') {
steps {
sh 'release/koji.sh'
sh 'release/content.sh'
}
}
stage('Create Update Stream') {
Expand Down
29 changes: 29 additions & 0 deletions release/content.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Copyright (C) 2018 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

set -e

SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))

. ${SCRIPT_DIR}/../globals.sh
. ${SCRIPT_DIR}/../common.sh

. ./config/config.sh

# ==============================================================================
# MAIN
# ==============================================================================
stage "Finalizing Content"

if [[ -z "$(ls -A ${PKGS_DIR})" ]]; then
info "Custom Content Not Found" " '${PKGS_DIR}' is empty."
exit 0
fi

section "Creating Content Repository"
pushd ${PKGS_DIR} > /dev/null
log_line
createrepo_c ${PKGS_DIR} # Output too verbose
log_line
popd > /dev/null
4 changes: 2 additions & 2 deletions release/koji.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
# ==============================================================================
# MAIN
# ==============================================================================
stage "Koji"
stage "Content Provider - Koji"

log_line "Fetching Package List:"
if result=$(koji_cmd list-tagged --latest --quiet ${KOJI_TAG}); then
Expand All @@ -26,7 +26,7 @@ fi
log_line "OK!" 1

section "Downloading RPMs"
pushd ${BUILD_DIR}/local-rpms > /dev/null
pushd ${PKGS_DIR} > /dev/null
for rpm in $(cat ${WORK_DIR}/${PKG_LIST_FILE}); do
log_line "${rpm}:"
koji_cmd download-build -a x86_64 --quiet ${rpm}
Expand Down
11 changes: 7 additions & 4 deletions release/mixer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,10 @@ echo
echo "MIX_INCREMENT=${MIX_INCREMENT}"
echo "CLR_BUNDLES=${CLR_BUNDLES:-"all from upstream"}"

assert_dir ${BUILD_DIR}
pushd ${BUILD_DIR} > /dev/null

section "Bootstrapping Mix Workspace"
mixer init --local-rpms --upstream-url ${CLR_PUBLIC_DL_URL}
mixer init --upstream-url ${CLR_PUBLIC_DL_URL}
mixer config set Swupd.CONTENTURL "${DSTREAM_DL_URL}/update"
mixer config set Swupd.VERSIONURL "${DSTREAM_DL_URL}/update"

Expand All @@ -141,8 +140,12 @@ fi
section "Preparing Downstream Content"
fetch_bundles # Download the Downstream Bundles Repository

if [[ -n "$(ls -A local-rpms)" ]];then
mixer add-rpms
log_line "Checking Downstream Repo:"
if [[ -n "$(ls -A ${PKGS_DIR})" ]];then
mixer repo set-url content file://${PKGS_DIR} > /dev/null
log_line "Content found. Adding it to the mix!" 1
else
log_line "Content not found. Skipping it." 1
fi

section "Building"
Expand Down
7 changes: 6 additions & 1 deletion release/prologue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ LOG_INDENT=1 fetch_config_repo
. ./config/config.sh

rm -rf ${WORK_DIR}
mkdir -p ${WORK_DIR}/release/{config,images,rpms}
mkdir -p ${WORK_DIR}/release/{config,images}
mkdir -p ${PKGS_DIR}

mkdir -p ${BUILD_DIR}
rm -rf ${BUILD_DIR}/local-rpms ${BUILD_DIR}/local-yum
Expand Down Expand Up @@ -60,6 +61,10 @@ Work dir:
${WORK_DIR}
Variables dir:
${VARS_DIR}
Repository dir:
${REPO_DIR}
Packages dir:
${PKGS_DIR}
Build dir:
${BUILD_DIR}
Stage dir:
Expand Down
4 changes: 2 additions & 2 deletions release/stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ RELEASE_DIR="${WORK_DIR}/release"
stage "Staging Release"

assert_dir ${BUILD_DIR}/local-bundles
assert_dir ${BUILD_DIR}/local-rpms
assert_dir ${REPO_DIR}
assert_dir ${RELEASE_DIR}
assert_dir ${STAGING_DIR}

log_line "Finishing 'release' folder"
mv ${WORK_DIR}/${BUILD_FILE} ${RELEASE_DIR}/${BUILD_FILE}-${MIX_VERSION}.txt
mv ${WORK_DIR}/${PKG_LIST_FILE} ${RELEASE_DIR}/${PKG_LIST_FILE}-${MIX_VERSION}.txt
mv ${WORK_DIR}/${RELEASE_NOTES} ${RELEASE_DIR}/${RELEASE_NOTES}-${MIX_VERSION}.txt
mv ${REPO_DIR}/ ${RELEASE_DIR}/repo/
cp -a ${BUILD_DIR}/Swupd_Root.pem ${RELEASE_DIR}/config/
rsync -ah ${BUILD_DIR}/local-rpms/ ${RELEASE_DIR}/rpms/
log_line "OK!" 1

log_line "Staging 'update'"
Expand Down

0 comments on commit 0fdee7a

Please sign in to comment.