Skip to content

Commit

Permalink
az-repo-apt-add: build and update Azure Storage based repo + tests fo…
Browse files Browse the repository at this point in the history
…r it
  • Loading branch information
GreyCat committed Aug 29, 2024
1 parent e10fd11 commit 75cc557
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
39 changes: 39 additions & 0 deletions az-repo-apt-add
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh -e

# Needs AZURE_STORAGE_SAS_TOKEN to be set

AZ_STORAGE_ACCOUNT=packageskaitai
AZ_STORAGE_CONTAINER=test3
REPO_DIR=repo0
PKGS_SRC=all_pkgs/*.deb

#az storage blob list --account-name "$AZ_STORAGE_ACCOUNT" --container-name "$AZ_STORAGE_CONTAINER"

download_existing_repo()
{
echo "## Downloading existing repo"
mkdir -p "$REPO_DIR/dists/stable/main/binary-all"
az storage blob download \
--account-name "$AZ_STORAGE_ACCOUNT" \
--container-name "$AZ_STORAGE_CONTAINER" \
--name "dists/stable/main/binary-all/Packages.gz" \
--file "$REPO_DIR/dists/stable/main/binary-all/Packages.gz"
}

upload_repo()
{
echo "## Uploading repo"
az storage blob upload-batch \
--account-name "$AZ_STORAGE_ACCOUNT" \
--destination "$AZ_STORAGE_CONTAINER" \
--overwrite \
--source "$REPO_DIR"
}

download_existing_repo || :

export REPO_DIR
export PKGS_SRC
./docker-repo-apt-handle

upload_repo
6 changes: 6 additions & 0 deletions docker-test-pkg-install-az
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh -ef

SCRIPT_DIR=$(dirname $0)
. "$SCRIPT_DIR/common.sh"

docker_run ./test-pkg-install-az
20 changes: 20 additions & 0 deletions test-pkg-install-az
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh -e
# Tests installation and runnability of a `kaitai-struct-compiler` package from a local repository

apt-get update
apt-get install -y ca-certificates

: "${REPO_DIR:=repo0}"
GPG_PUB_KEY_FILE=gpg/repo-pubkey.asc

cat "$GPG_PUB_KEY_FILE" | apt-key add -

echo "deb [arch=all] https://packages.kaitai.io/test3 stable main" | tee /etc/apt/sources.list.d/kaitai-test-az.list

#apt-get update --allow-insecure-repositories
#apt-get install -y --allow-unauthenticated kaitai-struct-compiler

apt-get update
apt-get install -y kaitai-struct-compiler default-jre-headless

kaitai-struct-compiler --version

0 comments on commit 75cc557

Please sign in to comment.