Skip to content

Commit 2b914fc

Browse files
authored
CICD: fix aptly repo management (algorand#5870)
1 parent 49f95cd commit 2b914fc

File tree

5 files changed

+16
-61
lines changed

5 files changed

+16
-61
lines changed

.aptly.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"rootDir": "/root/aptly",
32
"downloadConcurrency": 4,
43
"downloadSpeedLimit": 0,
54
"architectures": [],
@@ -27,4 +26,3 @@
2726
},
2827
"SwiftPublishEndpoints": {}
2928
}
30-

docker/build/aptly.Dockerfile

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:22.04
22

33
ARG ARCH=amd64
4-
ARG GOLANG_VERSION
5-
ENV DEBIAN_FRONTEND noninteractive
64

7-
RUN apt-get update && apt-get install aptly awscli binutils build-essential curl gnupg2 -y
8-
RUN curl https://dl.google.com/go/go${GOLANG_VERSION}.linux-${ARCH%v*}.tar.gz | tar -xzf - && mv go /usr/local
9-
ENV GOROOT=/usr/local/go \
10-
GOPATH=/root/go \
11-
PATH=$GOPATH/bin:$GOROOT/bin:$PATH
5+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install aptly awscli binutils build-essential curl gnupg2 -y
126

137
WORKDIR /root
148
COPY .aptly.conf .
15-
RUN curl https://releases.algorand.com/key.pub | gpg --no-default-keyring --keyring trustedkeys.gpg --import - && \
16-
aptly mirror create stable https://releases.algorand.com/deb/ stable main && \
9+
RUN curl https://releases.algorand.com/key.pub | gpg --no-default-keyring --keyring /root/.gnupg/trustedkeys.gpg --import -
10+
RUN gpg --no-default-keyring --keyring /root/.gnupg/trustedkeys.gpg --export --output /root/.gnupg/newkeyring.gpg && mv -f /root/.gnupg/newkeyring.gpg /root/.gnupg/trustedkeys.gpg
11+
RUN aptly mirror create stable https://releases.algorand.com/deb/ stable main && \
1712
aptly mirror create beta https://releases.algorand.com/deb/ beta main && \
18-
aptly repo create -distribution=stable -architectures=amd64 -component=main -comment=mainnet stable && \
19-
aptly repo create -distribution=beta -architectures=amd64 -component=main -comment=betanet beta && \
20-
aptly mirror update stable && \
21-
aptly mirror update beta && \
22-
aptly repo import stable stable algorand algorand-devtools && \
23-
aptly repo import beta beta algorand-beta algorand-devtools-beta
13+
aptly repo create -distribution=stable -architectures=amd64,arm64 -component=main -comment=mainnet stable && \
14+
aptly repo create -distribution=beta -architectures=amd64,arm64 -component=main -comment=betanet beta
2415

2516
CMD ["/bin/bash"]
26-

docker/build/docker.ubuntu.Dockerfile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,14 @@ ARG ARCH="amd64"
33
FROM ${ARCH}/ubuntu:20.04
44
ARG GOLANG_VERSION
55
ARG ARCH="amd64"
6-
RUN apt-get update && apt-get install curl python python3.7 python3-pip build-essential apt-transport-https ca-certificates software-properties-common -y && \
6+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install curl python python3.7 python3-pip build-essential apt-transport-https ca-certificates software-properties-common -y && \
77
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
8-
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
9-
apt-get update && apt-get install docker-ce -y
8+
DEBIAN_FRONTEND=noninteractive add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \
9+
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install docker-ce -y
1010

11-
# Mule needs >= python3.7 so set that as the default.
12-
RUN update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 && \
13-
update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2 && \
14-
update-alternatives --set python /usr/bin/python3.7 && \
15-
pip3 install mulecli
11+
RUN pip3 install mulecli
1612

17-
RUN apt-get update && apt-get install -y autoconf bsdmainutils git && \
13+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y autoconf bsdmainutils git && \
1814
curl https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz | tar -xzf - && \
1915
mv go /usr/local
2016

package-deploy.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ agents:
3030
dockerFilePath: docker/build/aptly.Dockerfile
3131
image: algorand/aptly
3232
version: scripts/configure_dev-deps.sh
33-
buildArgs:
34-
- GOLANG_VERSION=`./scripts/get_golang_version.sh`
3533
env:
3634
- AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
3735
- AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
@@ -42,6 +40,8 @@ agents:
4240
volumes:
4341
- $XDG_RUNTIME_DIR/gnupg/S.gpg-agent:/root/.gnupg/S.gpg-agent
4442
- $HOME/.gnupg/pubring.kbx:/root/.gnupg/pubring.kbx
43+
- $HOME/.gnupg/secring.gpg:/root/.gnupg/secring.gpg
44+
- $HOME/.aptly:/root/.aptly
4545
workDir: $HOME/projects/go-algorand
4646

4747
- name: rpm
@@ -64,7 +64,6 @@ agents:
6464
- $HOME/.gnupg/pubring.kbx:/root/.gnupg/pubring.kbx
6565
workDir: $HOME/projects/go-algorand
6666

67-
6867
tasks:
6968
- task: docker.Make
7069
name: docker

scripts/release/mule/deploy/deb/deploy.sh

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,7 @@ aptly mirror update beta
3232
aptly repo import stable stable algorand algorand-devtools
3333
aptly repo import beta beta algorand-beta algorand-devtools-beta
3434

35-
KEY_PREFIX="$CHANNEL/$VERSION"
36-
FILENAME_SUFFIX="${CHANNEL}_linux-amd64_${VERSION}.deb"
37-
ALGORAND_KEY="$KEY_PREFIX/algorand_${FILENAME_SUFFIX}"
38-
DEVTOOLS_KEY="$KEY_PREFIX/algorand-devtools_${FILENAME_SUFFIX}"
39-
40-
# `STAGING` could contain a "path" (i.e. "my_bucket/foo/bar"), but the
41-
# `s3api` api expects it to be only the bucket name (i.e., "my_bucket").
42-
BUCKET=$(awk -F/ '{ print $1 }' <<< "$STAGING")
43-
44-
# If the strings match then the objects are in the top-level of the bucket.
45-
if [ "$STAGING" = "$BUCKET" ]
46-
then
47-
BUCKET_PREFIX_PATH="$STAGING"
48-
else
49-
# Remove matching prefix.
50-
BUCKET_PREFIX_PATH=${STAGING#$BUCKET"/"}
51-
fi
52-
53-
for key in {"$ALGORAND_KEY","$DEVTOOLS_KEY"}
54-
do
55-
key="$BUCKET_PREFIX_PATH/$key"
56-
if aws s3api head-object --bucket "$BUCKET" --key "$key"
57-
then
58-
aws s3 cp "s3://$BUCKET/$key" "$PACKAGES_DIR"
59-
else
60-
echo "[$0] The package \`$key\` failed to download."
61-
fi
62-
done
35+
cp -f tmp/{algorand,algorand-devtools}_${CHANNEL}_linux-{amd64,arm64}_${VERSION}.deb $PACKAGES_DIR
6336

6437
if ls -A $PACKAGES_DIR
6538
then
@@ -68,12 +41,11 @@ then
6841
aptly snapshot create "$SNAPSHOT" from repo "$CHANNEL"
6942
if ! aptly publish show "$CHANNEL" s3:algorand-releases: &> /dev/null
7043
then
71-
aptly publish snapshot -gpg-key=dev@algorand.com -origin=Algorand -label=Algorand "$SNAPSHOT" s3:algorand-releases:
44+
aptly publish -batch snapshot -gpg-key=dev@algorand.com -origin=Algorand -label=Algorand "$SNAPSHOT" s3:algorand-releases:
7245
else
7346
aptly publish switch "$CHANNEL" s3:algorand-releases: "$SNAPSHOT"
7447
fi
7548
else
7649
echo "[$0] The packages directory is empty, so there is nothing to add the \`$CHANNEL\` repo."
7750
exit 1
7851
fi
79-

0 commit comments

Comments
 (0)