Skip to content

Commit

Permalink
CI: Ubuntu Delivery: Replace xenial with jammy
Browse files Browse the repository at this point in the history
Resolves buildpacks#1412
Resolves buildpacks#1455

Signed-off-by: Javier Romero <root@jromero.codes>
  • Loading branch information
jromero committed Jun 14, 2022
1 parent 69e612d commit 72fbc5a
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,33 @@ on:
tag_name:
description: The release tag to distribute
required: true
ubuntu_ppa:
description: flag indicating this is an ubuntu release
required: true


jobs:
create-ppa:
#if: github.event_name == 'release'
strategy:
fail-fast: false
matrix:
target: [xenial, bionic, focal]
include:
- target: xenial
runner: ubuntu-16.04
image: docker://ubuntu:16.04
i386-go-version: 1.13
- target: bionic
runner: ubuntu-18.04
image: docker://ubuntu:18.04
i386-go-version: 1.15
go-dep-entry: golang (>=1.16)
go-dep-package-name: golang
- target: focal
runner: ubuntu-20.04
image: docker://ubuntu:20.04
i386-go-version: none
go-dep-entry: golang (>=1.16)
go-dep-package-name: golang
- target: jammy
go-dep-entry: golang (>=1.16)
go-dep-package-name: golang
name: create-ppa
runs-on: ${{ matrix.runner }}

runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Metadata
id: metadata
run: |
echo "::set-output name=date::$(date +"%a, %d %b %Y %T %z")"
- name: Determine version
uses: actions/github-script@v6
id: version
Expand All @@ -50,21 +48,6 @@ jobs:
throw "ERROR: unable to determine tag"
}
return tag.replace(/^v/, '');
- name: Checkout code
uses: actions/checkout@v3

- name: Metadata
id: metadata
run: |
echo "::set-output name=date::$(date +"%a, %d %b %Y %T %z")"
- name: Install packaging tools
run: |
sudo apt-get update
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:longsleep/golang-backports -y
sudo apt-get update
sudo apt-get install gnupg dput dh-make devscripts lintian golang -y
- name: Fill debian/*
uses: cschleiden/replace-tokens@v1
Expand All @@ -74,7 +57,7 @@ jobs:
tokenSuffix: '}}'
env:
ARCH: "any"
I386_GO_VERSION: ${{matrix.i386-go-version}}
GO_DEP_ENTRY: ${{matrix.go-dep-entry}}
PACKAGE_NAME: "pack-cli"
UBUNTU_VERSION: ${{ matrix.target }}
HOMEPAGE: "https://buildpacks.io"
Expand All @@ -85,44 +68,71 @@ jobs:
MAINTAINER_NAME: "cncf-buildpacks"
MAINTAINER_EMAIL: "cncf-buildpacks-maintainers@lists.cncf.io"

- name: Create PPA
run: ./.github/workflows/scripts/create_ppa.sh
###
# NOTE: 'uses' does not suport interpolation so we have to manually define the
# followins steps per variant.
###

###
# CREATE
###
- name: Create PPA bionic
if: matrix.target == 'bionic'
uses: docker://ubuntu:bionic
with:
entrypoint: .github/workflows/delivery/ubuntu/build-create-ppa.sh
env:
PACKAGE_NAME: "pack-cli"
PACKAGE_VERSION: ${{ steps.version.outputs.result }}
MAINTAINER: "cncf-buildpacks"
MAINTANER_EMAIL: "cncf-buildpacks-maintainers@lists.cncf.io"
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}

- name: Test Xenial
if: matrix.target == 'xenial'
uses: docker://ubuntu:16.04
- name: Create PPA focal
if: matrix.target == 'focal'
uses: docker://ubuntu:focal
with:
entrypoint: .github/workflows/delivery/ubuntu/build-create-ppa.sh
env:
PACKAGE_NAME: "pack-cli"
PACKAGE_VERSION: ${{ steps.version.outputs.result }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}

- name: Create PPA jammy
if: matrix.target == 'jammy'
uses: docker://ubuntu:jammy
with:
entrypoint: .github/workflows/delivery/ubuntu/test-install-package.sh
entrypoint: .github/workflows/delivery/ubuntu/build-create-ppa.sh
env:
PACKAGE_VERSION: ${{ steps.version.outputs.result }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}

- name: Test Bionic
###
# TEST
###
- name: Test bionic
if: matrix.target == 'bionic'
uses: docker://ubuntu:18.04
env:
PACKAGE_NAME: "pack-cli"
uses: docker://ubuntu:bionic
with:
entrypoint: .github/workflows/delivery/ubuntu/test-install-package.sh
env:
GO_DEP_PACKAGE_NAME: ${{matrix.go-dep-package-name}}

- name: Test Focal
- name: Test focal
if: matrix.target == 'focal'
uses: docker://ubuntu:20.04
uses: docker://ubuntu:focal
with:
entrypoint: .github/workflows/delivery/ubuntu/test-install-package.sh
env:
PACKAGE_NAME: "pack-cli"
GO_DEP_PACKAGE_NAME: ${{matrix.go-dep-package-name}}

- name: Test jammy
if: matrix.target == 'jammy'
uses: docker://ubuntu:jammy
with:
entrypoint: .github/workflows/delivery/ubuntu/test-install-package.sh
env:
GO_DEP_PACKAGE_NAME: ${{matrix.go-dep-package-name}}

- name: Upload
run: |
dput "${PPA_DEST}" ./../*.changes
env:
PPA_DEST: "ppa:cncf-buildpacks/pack-cli"


dput "ppa:cncf-buildpacks/pack-cli" ./../*.changes
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ set -e
set -o pipefail

readonly PROG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly PACK_DIR="$(cd "${PROG_DIR}/../../.." && pwd)"
readonly PACKAGE_NAME="pack-cli"
readonly MAINTAINER="cncf-buildpacks"
readonly MAINTANER_EMAIL="cncf-buildpacks-maintainers@lists.cncf.io"

# verify the following are set.
: "$PACKAGE_VERSION"
: "$PACKAGE_NAME"
: "$GITHUB_WORKSPACE"

function main() {
function dependencies() {
apt-get update
apt-get install software-properties-common -y
add-apt-repository ppa:longsleep/golang-backports -y
apt-get update
apt-get install gnupg dput dh-make devscripts lintian golang -y
}

function main() {
# import secrets needed to sign packages we build with debuild
import_gpg

Expand All @@ -29,7 +37,7 @@ function main() {
dh_make -p "${PACKAGE_NAME}_${PACKAGE_VERSION}" --single --native --copyright apache --email "${MAINTAINER_EMAIL}" -y

# copy our templated configuration files.
cp "$PACK_DIR/.github/workflows/delivery/ubuntu/debian/"* debian/
cp "$PROG_DIR/debian/"* debian/

echo "compat"
cat debian/compat
Expand Down Expand Up @@ -58,7 +66,6 @@ function main() {

# build a source based debian package, Ubuntu ONLY accepts source packages.
debuild -S

}

# import gpg keys from env
Expand All @@ -71,4 +78,5 @@ function import_gpg() {
gpg --allow-secret-key-import --import <(echo "$GPG_PRIVATE_KEY")
}

dependencies
main
2 changes: 1 addition & 1 deletion .github/workflows/delivery/ubuntu/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: {{PACKAGE_NAME}}
Section: utils
Priority: optional
Maintainer: {{MAINTAINER_NAME}} <{{MAINTAINER_EMAIL}}>
Build-Depends: debhelper (>=9), git, golang (>=1.16) [!i386], golang-{{I386_GO_VERSION}} [i386]
Build-Depends: debhelper (>=9), git, {{GO_DEP_ENTRY}}
Standards-Version: 3.9.8
Vcs-Git: git@github.com/{{REPO}}.git
Vcs-Browser: https://github.com/{{REPO}}
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/delivery/ubuntu/test-install-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
set -e
set -o pipefail

# verify the following are set.
: "$GO_DEP_PACKAGE_NAME"

apt-get update

# install neede packaging utilities
DEBIAN_FRONTEND=noninteractive apt-get install git devscripts debhelper software-properties-common -y

Expand All @@ -18,7 +22,7 @@ pushd $testdir
# install golang using ppa
add-apt-repository ppa:longsleep/golang-backports -y
apt-get update
apt-get install golang -y
apt-get install $GO_DEP_PACKAGE_NAME -y

# build a debian binary package
debuild -b -us -uc
Expand All @@ -27,6 +31,6 @@ debuild -b -us -uc
dpkg -i ../*.deb

# list contents installed by the build debain package
dpkg -L ${PACKAGE_NAME}
dpkg -L pack-cli

popd

0 comments on commit 72fbc5a

Please sign in to comment.