-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add release-scripts to protocol repo #4487
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d6d30d2
Add release scripts folder to protocol
dmanjunath a1d0090
Dont forget to undo this
dmanjunath 0bdd27a
debug
dmanjunath 0d6e83e
chmod
dmanjunath 551862a
Add slack secret
dmanjunath 6603640
Cleanup
dmanjunath aca3e76
Merge branch 'main' of github.com:AudiusProject/audius-protocol into …
dmanjunath 55841a8
Move release-scripts into .circleci/ folder
dmanjunath 52fab9f
Testing
dmanjunath af17c32
Test fix
dmanjunath 32d2c29
Remove test code
dmanjunath File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Release to Production | ||
|
||
* [Deployment Design Doc](https://www.notion.so/Deployment-Design-Doc-67f4fb5fb7574320a45dd63082ec4adf) | ||
* [Deployment User Guide](https://www.notion.so/audiusproject/Deployment-User-Guide-708a8f64881740219d3f77707e73a097) | ||
|
||
Called via audius-protocol's CircleCI project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
script=bump-hotfix | ||
docker build \ | ||
-t ${script} \ | ||
release-scripts/dockerfiles/${script} | ||
|
||
SSH_KEY=$(cat ssh_keys/id_rsa_d00ba019ac4658e46cac3499f61b31bb) | ||
docker run \ | ||
-ti \ | ||
-e SSH_KEY="${SSH_KEY}" \ | ||
-e GH_TOKEN="${GH_TOKEN}" \ | ||
${script} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
script=cut-release | ||
docker build \ | ||
-t ${script} \ | ||
release-scripts/dockerfiles/${script} | ||
|
||
SSH_KEY=$(cat ssh_keys/id_rsa_d00ba019ac4658e46cac3499f61b31bb) | ||
docker run \ | ||
-ti \ | ||
-e SSH_KEY="${SSH_KEY}" \ | ||
-e GH_TOKEN="${GH_TOKEN}" \ | ||
${script} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
echo "test from circleci" | ||
pwd | ||
ls |
35 changes: 35 additions & 0 deletions
35
.circleci/release-scripts/dockerfiles/bump-hotfix/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV WORKDIR /app | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
gnupg \ | ||
jq \ | ||
moreutils \ | ||
wget \ | ||
&& sh -c "echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' \ | ||
>> /etc/apt/sources.list" \ | ||
&& wget -q 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' -O /tmp/gitsecret.key \ | ||
&& md5sum /tmp/gitsecret.key | grep -q "e941935ec5dd72a60086e1b5112ade3d" \ | ||
|| exit \ | ||
&& apt-key add /tmp/gitsecret.key \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
git-secret | ||
|
||
WORKDIR /tmp | ||
RUN wget https://github.com/tcnksm/ghr/releases/download/v0.15.0/ghr_v0.15.0_linux_amd64.tar.gz \ | ||
&& md5sum ghr_v0.15.0_linux_amd64.tar.gz | grep -q "b820693296a40bddb3873284f6051b87" \ | ||
|| exit \ | ||
&& tar xf ghr_v0.15.0_linux_amd64.tar.gz \ | ||
&& mv ghr_v0.15.0_linux_amd64/ghr ${WORKDIR}/ | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN git clone https://github.com/AudiusProject/audius-protocol.git | ||
|
||
COPY bump.sh ./ | ||
|
||
CMD ./bump.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
# required for ./ghr to create and tag Github Releases | ||
if [ "${GH_TOKEN}" == "" ]; then | ||
echo '$GH_TOKEN not set.' | ||
exit 1 | ||
fi | ||
|
||
# ensure ability to connect to Github | ||
eval $(ssh-agent) | ||
mkdir -p ~/.ssh/ | ||
echo "$SSH_KEY" > ~/.ssh/id_rsa | ||
chmod 400 ~/.ssh/id_rsa | ||
ssh-add ~/.ssh/id_* | ||
ssh-keyscan -H github.com >> ~/.ssh/known_hosts | ||
ssh -T git@github.com || true | ||
git config --global user.email "audius-infra@audius.co" | ||
git config --global user.name "audius-infra" | ||
git config --global url."git@github.com:".insteadOf "https://github.com/" | ||
|
||
# work in and always update the repo | ||
cd ${WORKDIR}/audius-protocol | ||
git pull | ||
|
||
# grab latest release version and hash | ||
RELEASE_VERSION=$(jq -r .version ${WORKDIR}/audius-protocol/discovery-provider/.version.json) | ||
OLD_VERSION=$(echo ${RELEASE_VERSION} | awk -F. '{$NF = $NF - 1;} 1' | sed 's/ /./g') | ||
git checkout release-v${RELEASE_VERSION} | ||
RELEASE_HASH=$(git rev-parse HEAD) | ||
|
||
function generate-changelog() { | ||
( | ||
SERVICE=${1} | ||
START_COMMIT=$(git show-ref --hash refs/tags/@audius/${SERVICE}@${OLD_VERSION}) | ||
CHANGE_LOG=$(git log --pretty=format:'[%h] - %s' --abbrev-commit ${START_COMMIT}..${RELEASE_HASH} ${SERVICE}) | ||
echo -e "Full Changelog:\n${CHANGE_LOG}" | ||
) | ||
} | ||
|
||
# recreate Github Releases (prerelease) + Git Tags | ||
${WORKDIR}/ghr \ | ||
-token ${GH_TOKEN} \ | ||
-username AudiusProject \ | ||
-repository audius-protocol \ | ||
-commitish ${RELEASE_HASH} \ | ||
-body "$(generate-changelog discovery-provider)" \ | ||
-name "Discovery Provider ${RELEASE_VERSION}" \ | ||
-delete \ | ||
-prerelease \ | ||
@audius/discovery-provider@${RELEASE_VERSION} | ||
|
||
${WORKDIR}/ghr \ | ||
-token ${GH_TOKEN} \ | ||
-username AudiusProject \ | ||
-repository audius-protocol \ | ||
-commitish ${RELEASE_HASH} \ | ||
-body "$(generate-changelog creator-node)" \ | ||
-name "Creator Node ${RELEASE_VERSION}" \ | ||
-delete \ | ||
-prerelease \ | ||
@audius/creator-node@${RELEASE_VERSION} |
35 changes: 35 additions & 0 deletions
35
.circleci/release-scripts/dockerfiles/cut-release/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ENV WORKDIR /app | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
gnupg \ | ||
jq \ | ||
moreutils \ | ||
wget \ | ||
&& sh -c "echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' \ | ||
>> /etc/apt/sources.list" \ | ||
&& wget -q 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' -O /tmp/gitsecret.key \ | ||
&& md5sum /tmp/gitsecret.key | grep -q "e941935ec5dd72a60086e1b5112ade3d" \ | ||
|| exit \ | ||
&& apt-key add /tmp/gitsecret.key \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
git-secret | ||
|
||
WORKDIR /tmp | ||
RUN wget https://github.com/tcnksm/ghr/releases/download/v0.15.0/ghr_v0.15.0_linux_amd64.tar.gz \ | ||
&& md5sum ghr_v0.15.0_linux_amd64.tar.gz | grep -q "b820693296a40bddb3873284f6051b87" \ | ||
|| exit \ | ||
&& tar xf ghr_v0.15.0_linux_amd64.tar.gz \ | ||
&& mv ghr_v0.15.0_linux_amd64/ghr ${WORKDIR}/ | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN git clone https://github.com/AudiusProject/audius-protocol.git | ||
|
||
COPY cut.sh ./ | ||
|
||
CMD ./cut.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
# required for ./ghr to create and tag Github Releases | ||
if [ "${GH_TOKEN}" == "" ]; then | ||
echo '$GH_TOKEN not set.' | ||
exit 1 | ||
fi | ||
|
||
# ensure ability to connect to Github | ||
eval $(ssh-agent) | ||
mkdir -p ~/.ssh/ | ||
echo "$SSH_KEY" > ~/.ssh/id_rsa | ||
chmod 400 ~/.ssh/id_rsa | ||
ssh-add ~/.ssh/id_* | ||
ssh-keyscan -H github.com >> ~/.ssh/known_hosts | ||
ssh -T git@github.com || true | ||
git config --global user.email "audius-infra@audius.co" | ||
git config --global user.name "audius-infra" | ||
git config --global url."git@github.com:".insteadOf "https://github.com/" | ||
|
||
# work in and always update the repo | ||
cd ${WORKDIR}/audius-protocol | ||
git pull | ||
|
||
# grab latest release version and generate new release version | ||
OLD_VERSION=$(jq -r .version ${WORKDIR}/audius-protocol/discovery-provider/.version.json) | ||
RELEASE_VERSION=$(echo ${OLD_VERSION} | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g') | ||
|
||
# update .version.json to new version | ||
JSON=${WORKDIR}/audius-protocol/discovery-provider/.version.json | ||
jq ".version=\"${RELEASE_VERSION}\"" ${JSON} | sponge ${JSON} | ||
JSON=${WORKDIR}/audius-protocol/creator-node/.version.json | ||
jq ".version=\"${RELEASE_VERSION}\"" ${JSON} | sponge ${JSON} | ||
|
||
# commit version bump and create release branch | ||
git add */.version.json | ||
git commit -m "Bump to version ${RELEASE_VERSION}" | ||
RELEASE_HASH=$(git rev-parse HEAD) | ||
git checkout -b release-v${RELEASE_VERSION} | ||
git push origin main | ||
git push origin release-v${RELEASE_VERSION} | ||
|
||
function generate-changelog() { | ||
( | ||
SERVICE=${1} | ||
START_COMMIT=$(git show-ref --hash refs/tags/@audius/${SERVICE}@${OLD_VERSION}) | ||
CHANGE_LOG=$(git log --pretty=format:'[%h] - %s' --abbrev-commit ${START_COMMIT}..${RELEASE_HASH} ${SERVICE}) | ||
echo -e "Full Changelog:\n${CHANGE_LOG}" | ||
) | ||
} | ||
|
||
# create Github Releases (prerelease) + Git Tags | ||
${WORKDIR}/ghr \ | ||
-token ${GH_TOKEN} \ | ||
-username AudiusProject \ | ||
-repository audius-protocol \ | ||
-commitish ${RELEASE_HASH} \ | ||
-body "$(generate-changelog discovery-provider)" \ | ||
-name "Discovery Provider ${RELEASE_VERSION}" \ | ||
-soft \ | ||
-prerelease \ | ||
@audius/discovery-provider@${RELEASE_VERSION} | ||
|
||
${WORKDIR}/ghr \ | ||
-token ${GH_TOKEN} \ | ||
-username AudiusProject \ | ||
-repository audius-protocol \ | ||
-commitish ${RELEASE_HASH} \ | ||
-body "$(generate-changelog creator-node)" \ | ||
-name "Creator Node ${RELEASE_VERSION}" \ | ||
-soft \ | ||
-prerelease \ | ||
@audius/creator-node@${RELEASE_VERSION} |
39 changes: 39 additions & 0 deletions
39
.circleci/release-scripts/dockerfiles/evaluate-proposal/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM node:16 | ||
|
||
ENV WORKDIR /app | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
gnupg \ | ||
jq \ | ||
moreutils \ | ||
wget \ | ||
&& sh -c "echo 'deb https://gitsecret.jfrog.io/artifactory/git-secret-deb git-secret main' \ | ||
>> /etc/apt/sources.list" \ | ||
&& wget -q 'https://gitsecret.jfrog.io/artifactory/api/gpg/key/public' -O /tmp/gitsecret.key \ | ||
&& md5sum /tmp/gitsecret.key | grep -q "e941935ec5dd72a60086e1b5112ade3d" \ | ||
|| exit \ | ||
&& apt-key add /tmp/gitsecret.key \ | ||
&& apt-get update \ | ||
&& apt-get install -y \ | ||
git-secret | ||
|
||
WORKDIR /tmp | ||
RUN wget https://github.com/tcnksm/ghr/releases/download/v0.15.0/ghr_v0.15.0_linux_amd64.tar.gz \ | ||
&& md5sum ghr_v0.15.0_linux_amd64.tar.gz | grep -q "b820693296a40bddb3873284f6051b87" \ | ||
|| exit \ | ||
&& tar xf ghr_v0.15.0_linux_amd64.tar.gz \ | ||
&& mv ghr_v0.15.0_linux_amd64/ghr ${WORKDIR}/ | ||
WORKDIR ${WORKDIR} | ||
|
||
RUN git clone https://github.com/AudiusProject/audius-protocol.git \ | ||
&& git clone https://github.com/AudiusProject/audius-docker-compose.git | ||
|
||
COPY package.json ./ | ||
RUN npm install | ||
|
||
COPY evaluate.js ./ | ||
|
||
CMD npm run main |
55 changes: 55 additions & 0 deletions
55
.circleci/release-scripts/dockerfiles/evaluate-proposal/evaluate.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const { libs } = require('@audius/sdk') | ||
const HDWalletProvider = require('@truffle/hdwallet-provider') | ||
const Web3 = require('web3') | ||
|
||
const localKeyProvider = new HDWalletProvider({ | ||
privateKeys: [process.env.OWNER_PRIVATE_KEY], | ||
providerOrUrl: process.env.ETH_PROVIDER_ENDPOINT, | ||
}) | ||
const providers = [new Web3(localKeyProvider)] | ||
|
||
const audiusLibs = new libs({ | ||
ethWeb3Config: libs.configEthWeb3( | ||
process.env.ETH_TOKEN_ADDRESS, | ||
process.env.ETH_REGISTRY_ADDRESS, | ||
providers, | ||
process.env.OWNER_WALLET | ||
), | ||
isServer: true, | ||
enableUserReplicaSetManagerContract: true | ||
}) | ||
|
||
const main = async () => { | ||
await audiusLibs.init() | ||
const web3 = audiusLibs.ethWeb3Manager.getWeb3() | ||
|
||
const inProgressIds = await audiusLibs.ethContracts.GovernanceClient.getInProgressProposals() | ||
console.log(`Found ${inProgressIds.length} in progress proposals: ${inProgressIds}`) | ||
|
||
for (const proposalId of inProgressIds) { | ||
console.log(`Evaluating proposal: ${proposalId}`) | ||
|
||
try { | ||
const txReceipt = await audiusLibs.ethContracts.GovernanceClient.evaluateProposalOutcome( | ||
proposalId | ||
) | ||
|
||
console.log(txReceipt) | ||
console.log(JSON.stringify(txReceipt)) | ||
|
||
// TODO: Determine if proposal was evaluated as expected | ||
// if (txReceipt.logs[0].event == 'ProposalOutcomeEvaluated') { | ||
// console.log(`ProposalOutcomeEvaluated: ${proposalId}`) | ||
// } else { | ||
// console.error(`Proposal ${proposalId} outcome: ${txReceipt}.`) | ||
// } | ||
} catch (e) { | ||
console.error(`Error evaluating proposal: ${proposalId}`) | ||
console.error(e.stack) | ||
} | ||
} | ||
console.log('done.') | ||
process.exit(0) | ||
} | ||
|
||
main() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THANKS