good morning!!!!

Skip to content
Snippets Groups Projects
Commit 1a6c93b0 authored by a's avatar a
Browse files

img

parent dfae218a
Branches
No related tags found
No related merge requests found
Pipeline #3217 failed
Pipeline: Erigon

#3218

    local jobs = [
    {name: "erigon", merge: {}},
    ];
    local param_job(image,tag_var, merge = {}) = std.mergePatch({
    stage: 'build',
    image: {
    name: 'gcr.io/kaniko-project/executor:debug',
    entrypoint: [''],
    },
    script: [
    'mkdir -p /kaniko/.docker',
    @'echo "{\"auths\":{\"${CI_REGISTRY}\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64)\"}}}" > /kaniko/.docker/config.json',
    std.strReplace(|||
    /kaniko/executor
    --context ${CI_PROJECT_DIR}
    --cache=true
    --cache-repo="${CI_REGISTRY_IMAGE}/kaniko/cache"
    --dockerfile "${CI_PROJECT_DIR}/%(img)s.Dockerfile"
    --destination "${CI_REGISTRY_IMAGE}/%(img)s:%(tag_var)s"
    --destination "${CI_REGISTRY_IMAGE}/%(img)s:latest"
    ||| % {img: image, tag_var: tag_var}, "\n", " "),
    ]
    }, merge);
    {
    [job.name+"-tag"]: param_job(job.name,"${CI_COMMIT_TAG}",std.mergePatch(job.merge, {only:["tags"]}))
    for job in jobs
    } + {
    [job.name]: param_job(job.name,"${CI_COMMIT_SHORT_SHA}",job.merge)
    for job in jobs
    }
    jsonnet:
    stage: build
    image: alpine:latest
    script:
    - apk add -U jsonnet
    - jsonnet .gitlab-ci.jsonnet > generated-config.yml
    artifacts:
    paths:
    - generated-config.yml
    trigger-builds:
    stage: build
    needs:
    - jsonnet
    trigger:
    include:
    - artifact: generated-config.yml
    job: jsonnet
    strategy: depend
    ......@@ -19,6 +19,7 @@ type requestBody struct {
    const (
    urlPath = "/health"
    urlPathSynced = "/synced"
    )
    var (
    ......@@ -30,10 +31,38 @@ func ProcessHealthcheckIfNeeded(
    r *http.Request,
    rpcAPI []rpc.API,
    ) bool {
    if !strings.EqualFold(r.URL.Path, urlPath) {
    if strings.EqualFold(r.URL.Path, urlPathSynced) {
    return processSyncedCheck(w, r, rpcAPI)
    }
    if strings.EqualFold(r.URL.Path, urlPath) {
    return processHealthCheck(w, r, rpcAPI)
    }
    return false
    }
    func processSyncedCheck(
    w http.ResponseWriter,
    r *http.Request,
    rpcAPI []rpc.API,
    ) bool {
    _, ethAPI := parseAPI(rpcAPI)
    i, err := ethAPI.Syncing(r.Context())
    if err != nil {
    log.Root().Warn("unable to process sync request", "err", err.Error())
    return true
    }
    if i == nil {
    w.Write([]byte("ok"))
    }
    return true
    }
    func processHealthCheck(
    w http.ResponseWriter,
    r *http.Request,
    rpcAPI []rpc.API,
    ) bool {
    netAPI, ethAPI := parseAPI(rpcAPI)
    var errMinPeerCount = errCheckDisabled
    ......
    ......@@ -13,4 +13,5 @@ type NetAPI interface {
    type EthAPI interface {
    GetBlockByNumber(_ context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error)
    Syncing(ctx context.Context) (interface{}, error)
    }
    # syntax = docker/dockerfile:1.2
    FROM docker.io/library/golang:1.18-alpine3.15 AS builder
    RUN apk --no-cache add build-base linux-headers git bash ca-certificates libstdc++
    WORKDIR /app
    ADD . .
    RUN --mount=type=cache,target=/root/.cache \
    --mount=type=cache,target=/tmp/go-build \
    --mount=type=cache,target=/go/pkg/mod \
    make all db-tools
    FROM docker.io/library/alpine:3.15
    RUN apk add --no-cache ca-certificates libstdc++ tzdata
    COPY --from=builder /app/build/bin/* /usr/local/bin/
    ARG PUID=1000
    ARG PGID=1000
    RUN adduser -H -u ${PUID} -g ${PGID} -D erigon
    RUN mkdir -p /home/erigon
    RUN mkdir -p /home/erigon/.local/share/erigon
    RUN chown -R erigon:erigon /home/erigon
    USER erigon
    EXPOSE 8545 8551 8546 30303 30303/udp 42069 42069/udp 8080 9090 6060
    # https://github.com/opencontainers/image-spec/blob/main/annotations.md
    ARG BUILD_DATE
    ARG VCS_REF
    ARG VERSION
    LABEL org.label-schema.build-date=$BUILD_DATE \
    org.label-schema.name="Erigon" \
    org.label-schema.description="Erigon Ethereum Client" \
    org.label-schema.url="https://torquem.ch" \
    org.label-schema.vcs-ref=$VCS_REF \
    org.label-schema.vcs-url="https://github.com/ledgerwatch/erigon.git" \
    org.label-schema.vendor="Torquem" \
    org.label-schema.version=$VERSION \
    org.label-schema.schema-version="1.0"
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment