Skip to content

Commit

Permalink
rebase develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed May 8, 2024
2 parents 64de5bd + 372c9ec commit 216866e
Show file tree
Hide file tree
Showing 814 changed files with 24,414 additions and 17,823 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* @brewmaster012 @kingpinXD @kevinssgh @lumtis @ws4charlie @skosito
* @brewmaster012 @kingpinXD @lumtis @ws4charlie @skosito

.github/** @zeta-chain/devops
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@ jobs:
skip_aws_cli: "true"
skip_docker_compose: "false"

- run: |
echo "github.repository: ${{ github.repository }}"
echo "github.event.pull_request.head.repo.full_name: ${{ github.event.pull_request.head.repo.full_name }}"
- name: Login to Docker Hub
uses: docker/login-action@v2
if: github.event.repository.full_name == 'zeta-chain/node'
if: github.event_name != 'pull_request' || github.repository == github.event.pull_request.head.repo.full_name
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_READ_ONLY }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/generate-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Generate Go code, docs and specs
env:
TEST_ENV: ${{ github.workspace }}
run: make generate

- name: Check for changes
Expand Down
106 changes: 68 additions & 38 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,28 @@ on:
required: false
default: false
description: 'Use this to skip: gosec, gosec-cosmos, check-changelog, check-upgrade-uandler-updated, build-test, smoke-test and go straight to approval step.'
skip_release:
type: boolean
required: false
default: false
description: 'If this is true it will simply execute all the steps for a release prior to actually cutting the release, then stop'

concurrency:
group: publish-release
cancel-in-progress: false

jobs:
check_branch:
if: ${{ (startsWith(github.ref, 'refs/heads/release/v') || startsWith(github.ref, 'refs/heads/hotfix/v')) }}
runs-on: ubuntu-latest
steps:
- name: Branch
run: |
echo "${{ github.ref }}"
gosec:
needs:
- check_branch
runs-on: ubuntu-latest
env:
GO111MODULE: on
Expand All @@ -41,13 +56,15 @@ jobs:
with:
args: ./...

- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
gosec-cosmos:
needs:
- check_branch
runs-on: ubuntu-latest
env:
GO111MODULE: on
Expand All @@ -68,12 +85,15 @@ jobs:
if: ${{ github.event.inputs.skip_checks != 'true' }}
run: make lint-cosmos-gosec

- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
lint:
needs:
- check_branch
runs-on: ubuntu-latest
timeout-minutes: 15
env:
Expand All @@ -99,12 +119,15 @@ jobs:
skip-cache: true
args: --out-format=json

- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
check-changelog:
needs:
- check_branch
runs-on: ubuntu-latest
steps:

Expand All @@ -122,7 +145,6 @@ jobs:
https://api.github.com/repos/${{ github.repository }}/git/ref/heads/develop | jq -r '.object.sha')
echo "DEVELOP_SHA=${SHA}" >> ${GITHUB_ENV}
echo "CURRENT_BRANCH_SHA=${{ github.sha }}" >> ${GITHUB_ENV}
- name: Check for CHANGELOG.md changes
if: ${{ github.event.inputs.skip_checks != 'true' }}
Expand All @@ -139,12 +161,15 @@ jobs:
echo "CHANGELOG.md has been updated."
fi
- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
check-upgrade-handler-updated:
needs:
- check_branch
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand All @@ -168,12 +193,15 @@ jobs:
fi
echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!"
- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
build-test:
needs:
- check_branch
runs-on: buildjet-4vcpu-ubuntu-2004
timeout-minutes: 15
concurrency:
Expand Down Expand Up @@ -242,12 +270,15 @@ jobs:
shell: bash
run: rm -rf *

- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
smoke-test:
needs:
- check_branch
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 25
steps:
Expand Down Expand Up @@ -317,15 +348,15 @@ jobs:
shell: bash
run: sudo rm -rf *

- name: Skip Checks Succeed for Needs.
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "Check Skipped, Mark Green for Pipeline Execution"
echo "continue"
e2e-admin-tests:
needs:
- check_branch
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 120
steps:
Expand All @@ -339,7 +370,15 @@ jobs:
run: |
make start-e2e-admin-test
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "continue"
e2e-upgrade-test:
needs:
- check_branch
runs-on: buildjet-4vcpu-ubuntu-2204
timeout-minutes: 120
steps:
Expand All @@ -353,9 +392,14 @@ jobs:
run: |
make start-upgrade-test
approval:
runs-on: ubuntu-latest
timeout-minutes: 10
- name: Mark Job Complete Skipped
if: ${{ github.event.inputs.skip_checks == 'true' }}
shell: bash
run: |
echo "continue"
publish-release:
if: ${{ github.event.inputs.skip_release == 'false' }}
needs:
- gosec
- gosec-cosmos
Expand All @@ -366,24 +410,10 @@ jobs:
- build-test
- e2e-admin-tests
- e2e-upgrade-test
steps:

- uses: trstringer/manual-approval@v1
with:
secret: ${{ github.TOKEN }}
approvers: kingpinXD,lumtis,brewmaster012,CharlieMc0
minimum-approvals: 1
issue-title: "[Release] Approval, version: ${{ github.event.inputs.version }}"
issue-body: "Once approved the release pipeline will continue."
exclude-workflow-initiator-as-approver: true
additional-approved-words: ''
additional-denied-words: ''
publish-release:
- check_branch
runs-on: buildjet-4vcpu-ubuntu-2004
timeout-minutes: 60
needs:
- approval

environment: release
steps:
- uses: actions/checkout@v3

Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ RUN go mod download
# Copy the rest of the source code and build the application
COPY . .

RUN make install
RUN expected_major_version=$(grep 'const releaseVersion = ' app/setup_handlers.go | awk -F'"' '{print $2}') && \
make install VERSION="${expected_major_version}" && \
git_hash=$(git rev-parse --short HEAD) && \
echo -n "${expected_major_version}-${git_hash}" > /go/delivery/zeta-node/expected_major_version

# Run Stage
FROM alpine:3.18
Expand All @@ -46,6 +49,7 @@ RUN apk --no-cache add git jq bash curl nano vim tmux python3 libusb-dev linux-h
# Copy the binaries from the build stage
COPY --from=builder /go/bin/zetaclientd /usr/local/bin/zetaclientd
COPY --from=builder /go/bin/zetacored /usr/local/bin/zetacored
COPY --from=builder /go/delivery/zeta-node/expected_major_version /scripts/expected_major_version

# Set the working directory
WORKDIR /usr/local/bin
Expand Down
40 changes: 22 additions & 18 deletions Dockerfile-upgrade
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine3.18
FROM golang:1.20-alpine3.18 as base

# Purpose: This Dockerfile creates an environment for performing an upgrade test on ZetaChain
# It contains the ZetaChain and ZetaClient binaries for two different versions of ZetaChain
Expand All @@ -8,6 +8,7 @@ FROM golang:1.20-alpine3.18
ENV GOPATH /go
ENV GOOS=linux
ENV CGO_ENABLED=1
ENV GOCACHE=/root/.cache/go-build

RUN apk --no-cache add git make build-base jq openssh libusb-dev linux-headers bash curl tmux
RUN ssh-keygen -b 2048 -t rsa -f /root/.ssh/localtest.pem -q -N ""
Expand All @@ -20,32 +21,35 @@ WORKDIR /go/delivery/zeta-node
RUN mkdir -p $GOPATH/bin/old
RUN mkdir -p $GOPATH/bin/new

ARG OLD_VERSION=v14.0.0
ENV NEW_VERSION=v15

# Build new release from the current source
COPY go.mod /go/delivery/zeta-node/
COPY go.sum /go/delivery/zeta-node/
RUN cd /go/delivery/zeta-node/ && go mod download
COPY . /go/delivery/zeta-node/
RUN cd /go/delivery/zeta-node/ && make install
RUN cd /go/delivery/zeta-node/ && make install-zetae2e
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/
RUN ssh-keygen -A
RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys

# Checkout and build old binary
FROM base as oldbuild
ARG OLD_VERSION
RUN git clone https://github.com/zeta-chain/node.git
RUN cd node && git fetch

RUN cd node && git checkout ${OLD_VERSION}
RUN cd node && make install
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/old/
RUN cp $GOPATH/bin/zetaclientd $GOPATH/bin/old/

RUN ssh-keygen -A
WORKDIR /root
# Build new release from the current source
FROM base
ARG NEW_VERSION
ENV NEW_VERSION=${NEW_VERSION}
COPY go.mod /go/delivery/zeta-node/
COPY go.sum /go/delivery/zeta-node/
RUN cd /go/delivery/zeta-node/ && go mod download
COPY . /go/delivery/zeta-node/
RUN --mount=type=cache,target="/root/.cache/go-build" cd /go/delivery/zeta-node/ && make install
RUN --mount=type=cache,target="/root/.cache/go-build" cd /go/delivery/zeta-node/ && make install-zetae2e
RUN cp $GOPATH/bin/zetacored $GOPATH/bin/new/ && \
cp $GOPATH/bin/zetaclientd $GOPATH/bin/new/

RUN cp /root/.ssh/localtest.pem.pub /root/.ssh/authorized_keys
COPY --from=oldbuild $GOPATH/bin/zetacored $GOPATH/bin/zetaclientd $GOPATH/bin/
COPY --from=oldbuild $GOPATH/bin/zetacored $GOPATH/bin/zetaclientd $GOPATH/bin/old

WORKDIR /root

RUN cp /go/bin/zetaclientd /usr/local/bin
RUN cp /go/bin/zetacored /usr/local/bin
Expand Down
Loading

0 comments on commit 216866e

Please sign in to comment.