Compare commits
No commits in common. "00751ec6effac5eb8c2550f3d6c516ffc99484b1" and "35c0faccb79ded4d2dd763b8f9fe3273788fb74a" have entirely different histories.
00751ec6ef
...
35c0faccb7
3 changed files with 172 additions and 78 deletions
114
.woodpecker/compliance-and-tests.yml
Normal file
114
.woodpecker/compliance-and-tests.yml
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
platform: linux/amd64
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- &golang_image 'golang:1.19'
|
||||||
|
- &gitea_test_env_image 'gitea/test_env:linux-amd64'
|
||||||
|
- &git_image 'docker:git'
|
||||||
|
- &drone_git_image 'drone/git'
|
||||||
|
|
||||||
|
workspace:
|
||||||
|
base: /go
|
||||||
|
path: src/codeberg/gitea
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
dummy:
|
||||||
|
image: *golang_image
|
||||||
|
commands:
|
||||||
|
- exit 0
|
||||||
|
|
||||||
|
# deps-backend:
|
||||||
|
# image: *golang_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - goproxy_override
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - make deps-backend
|
||||||
|
|
||||||
|
# security-check:
|
||||||
|
# image: *golang_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - goproxy_override
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - make security-check
|
||||||
|
|
||||||
|
# lint-backend:
|
||||||
|
# image: *gitea_test_env_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - goproxy_override
|
||||||
|
# environment:
|
||||||
|
# - TAGS=bindata sqlite sqlite_unlock_notify
|
||||||
|
# - GOSUMDB=sum.golang.org
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - make lint-backend
|
||||||
|
|
||||||
|
# checks-backend:
|
||||||
|
# image: *golang_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - goproxy_override
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - make --always-make checks-backend
|
||||||
|
|
||||||
|
# fetch-tags:
|
||||||
|
# image: *git_image
|
||||||
|
# pull: true
|
||||||
|
# commands:
|
||||||
|
# - git config --add safe.directory '*'
|
||||||
|
# - git fetch --tags --force
|
||||||
|
|
||||||
|
# tag-pre-condition:
|
||||||
|
# image: *drone_git_image
|
||||||
|
# pull: true
|
||||||
|
# commands:
|
||||||
|
# - git update-ref refs/heads/tag_test ${CI_COMMIT_SHA}
|
||||||
|
|
||||||
|
# prepare-test-env:
|
||||||
|
# image: *gitea_test_env_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - goproxy_override
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - ./build/test-env-prepare.sh
|
||||||
|
|
||||||
|
# build-test:
|
||||||
|
# image: *gitea_test_env_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - goproxy_override
|
||||||
|
# environment:
|
||||||
|
# - GOSUMDB=sum.golang.org
|
||||||
|
# - TAGS=bindata sqlite sqlite_unlock_notify
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - su gitea -c './build/test-env-check.sh'
|
||||||
|
# - su gitea -c 'make backend'
|
||||||
|
|
||||||
|
# unit-test:
|
||||||
|
# image: *gitea_test_env_image
|
||||||
|
# pull: true
|
||||||
|
# secrets:
|
||||||
|
# - github_read_token
|
||||||
|
# - goproxy_override
|
||||||
|
# environment:
|
||||||
|
# - TAGS=bindata sqlite sqlite_unlock_notify
|
||||||
|
# - RACE_ENABLED=true
|
||||||
|
# commands:
|
||||||
|
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
|
# - su gitea -c 'make unit-test-coverage test-check'
|
||||||
|
|
||||||
|
# test-sqlite:
|
||||||
|
# image: *gitea_test_env_image
|
||||||
|
# environment:
|
||||||
|
# - USE_REPO_TEST_DIR=1
|
||||||
|
# - GOPROXY=off
|
||||||
|
# - TAGS=bindata gogit sqlite sqlite_unlock_notify
|
||||||
|
# - TEST_TAGS=bindata gogit sqlite sqlite_unlock_notify
|
||||||
|
# commands:
|
||||||
|
# - su gitea -c 'timeout -s ABRT 120m make test-sqlite-migration test-sqlite'
|
|
@ -1,7 +1,7 @@
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
|
|
||||||
# depends_on:
|
depends_on:
|
||||||
# - compliance-and-tests
|
- compliance-and-tests
|
||||||
|
|
||||||
workspace:
|
workspace:
|
||||||
base: /source
|
base: /source
|
||||||
|
@ -23,44 +23,44 @@ variables:
|
||||||
- &docker_platforms 'linux/amd64,linux/arm64'
|
- &docker_platforms 'linux/amd64,linux/arm64'
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
# fetch-tags:
|
fetch-tags:
|
||||||
# image: *git_image
|
image: *git_image
|
||||||
# pull: true
|
pull: true
|
||||||
# commands:
|
commands:
|
||||||
# - git config --add safe.directory '*'
|
- git config --add safe.directory '*'
|
||||||
# - git fetch --tags --force
|
- git fetch --tags --force
|
||||||
|
|
||||||
# deps-frontend:
|
deps-frontend:
|
||||||
# image: *node_image
|
image: *node_image
|
||||||
# pull: true
|
pull: true
|
||||||
# commands:
|
commands:
|
||||||
# - make deps-frontend
|
- make deps-frontend
|
||||||
|
|
||||||
# deps-backend:
|
deps-backend:
|
||||||
# image: *golang_image
|
image: *golang_image
|
||||||
# pull: true
|
pull: true
|
||||||
# commands:
|
commands:
|
||||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
# - make deps-backend
|
- make deps-backend
|
||||||
# secrets:
|
secrets:
|
||||||
# - goproxy_override
|
- goproxy_override
|
||||||
|
|
||||||
# build-static:
|
build-static:
|
||||||
# image: *xgo_image
|
image: *xgo_image
|
||||||
# pull: true
|
pull: true
|
||||||
# commands:
|
commands:
|
||||||
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
- test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
|
||||||
# - echo "installing nodejs"
|
- echo "installing nodejs"
|
||||||
# - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
|
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
|
||||||
# - export PATH=$PATH:$GOPATH/bin
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
# - echo "building forgejo"
|
- echo "building forgejo"
|
||||||
# - make CI=true LINUX_ARCHS=$${LINUX_ARCHS} release
|
- make CI=true LINUX_ARCHS=$${LINUX_ARCHS} release
|
||||||
# environment:
|
environment:
|
||||||
# TAGS: bindata sqlite sqlite_unlock_notify
|
TAGS: bindata sqlite sqlite_unlock_notify
|
||||||
# DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
# LINUX_ARCHS: *make_platforms
|
LINUX_ARCHS: *make_platforms
|
||||||
# secrets:
|
secrets:
|
||||||
# - goproxy_override
|
- goproxy_override
|
||||||
|
|
||||||
# gpg-sign:
|
# gpg-sign:
|
||||||
# image: *gpgsign_plugin_image
|
# image: *gpgsign_plugin_image
|
||||||
|
@ -97,18 +97,14 @@ pipeline:
|
||||||
image: *golang_image
|
image: *golang_image
|
||||||
pull: true
|
pull: true
|
||||||
commands:
|
commands:
|
||||||
- env | grep -vi drone | sort -h
|
- ls -la ./*
|
||||||
- mkdir -p /source/dist/release
|
|
||||||
- touch /source/dist/release/forgejo-${CI_COMMIT_TAG##v}-linux-arm64
|
|
||||||
- touch /source/dist/release/forgejo-${CI_COMMIT_TAG##v}-linux-amd64
|
|
||||||
- mkdir tmp-bin
|
|
||||||
- cp -r dist/* tmp-bin/
|
|
||||||
|
|
||||||
build-docker:
|
build-docker:
|
||||||
image: *buildx_plugin_image
|
image: *buildx_plugin_image
|
||||||
pull: true
|
pull: true
|
||||||
settings:
|
settings:
|
||||||
dockerfile: Dockerfile.ci
|
dockerfile: Dockerfile.ci
|
||||||
|
no_cache: true
|
||||||
platforms: *docker_platforms
|
platforms: *docker_platforms
|
||||||
registry:
|
registry:
|
||||||
from_secret: domain
|
from_secret: domain
|
||||||
|
@ -117,11 +113,11 @@ pipeline:
|
||||||
build_args:
|
build_args:
|
||||||
- TAG=${CI_COMMIT_TAG##v}
|
- TAG=${CI_COMMIT_TAG##v}
|
||||||
build_args_from_env:
|
build_args_from_env:
|
||||||
|
- CI_COMMIT_TAG
|
||||||
- CI_REPO_CLONE_URL
|
- CI_REPO_CLONE_URL
|
||||||
- CI_COMMIT_SHA
|
|
||||||
password:
|
password:
|
||||||
from_secret: releaseteamtoken
|
from_secret: releaseteamtoken
|
||||||
username:
|
username:
|
||||||
from_secret: releaseteamuser
|
from_secret: releaseteamuser
|
||||||
# when:
|
when:
|
||||||
# event: tag
|
event: tag
|
||||||
|
|
|
@ -1,39 +1,30 @@
|
||||||
FROM --platform=$BUILDPLATFORM golang:1.19 AS build-env
|
FROM --platform=$BUILDPLATFORM codeberg.org/forgejo/golang:1.19-alpine3.17 AS build-env
|
||||||
ARG BUILDPLATFORM
|
ARG BUILDPLATFORM
|
||||||
|
|
||||||
ARG GOPROXY
|
ARG GOPROXY
|
||||||
ENV GOPROXY "${GOPROXY:-direct}"
|
ENV GOPROXY ${GOPROXY:-direct}
|
||||||
|
|
||||||
ARG TAG
|
ARG TAG main
|
||||||
ENV TAG ${TAG:-main}
|
|
||||||
|
|
||||||
ARG CI_COMMIT_SHA
|
ARG CI_COMMIT_SHA
|
||||||
ENV CI_COMMIT_SHA "${CI_COMMIT_SHA}"
|
|
||||||
|
|
||||||
ARG CI_REPO_CLONE_URL
|
ARG CI_REPO_CLONE_URL
|
||||||
ENV CI_REPO_CLONE_URL "${CI_REPO_CLONE_URL}"
|
|
||||||
|
|
||||||
# Shorthands for easy use and ease of replacement
|
# Shorthands for easy use and ease of replacement
|
||||||
ARG OUT
|
ARG OUT "/out-bins"
|
||||||
ENV OUT "${OUT:-/out-bins}"
|
ARG DR "/docker/root"
|
||||||
ARG DR
|
|
||||||
ENV DR "${DR:-"/docker/root"}"
|
|
||||||
|
|
||||||
# Check vars and create directories
|
# Check vars and create directories
|
||||||
RUN test -n "$CI_COMMIT_SHA" || (echo "CI_COMMIT_SHA is required but not set" >&2 && exit 1) && \
|
RUN test -n "$CI_COMMIT_SHA" || (echo "CI_COMMIT_SHA is required but not set" >&2 && exit 1) && \
|
||||||
test -n "$CI_REPO_CLONE_URL" || (echo "CI_REPO_CLONE_URL is required but not set" >&2 && exit 1) && \
|
test -n "$CI_REPO_CLONE_URL" || (echo "CI_REPO_CLONE_URL is required but not set" >&2 && exit 1) && \
|
||||||
echo "Running prep for ${CI_REPO_CLONE_URL} commit ${CI_COMMIT_SHA}" && \
|
echo "Running prep for ${CI_REPO_CLONE_URL} commit ${CI_COMMIT_SHA}" && \
|
||||||
echo "Preparin out directories ${OUT}" && \
|
|
||||||
mkdir -p "${OUT}/linux/amd64" && \
|
mkdir -p "${OUT}/linux/amd64" && \
|
||||||
mkdir -p "${OUT}/linux/arm64" && \
|
mkdir -p "${OUT}/linux/arm64" && \
|
||||||
echo "Creating build dir" && \
|
|
||||||
mkdir /build && \
|
mkdir /build && \
|
||||||
echo "Creating docker root prep dir ${DR}" && \
|
|
||||||
mkdir -p "${DR}"
|
mkdir -p "${DR}"
|
||||||
|
|
||||||
# Copying the arch specific binaries to the path easily accessible in the next step and rename them to gitea
|
# Copying the arch specific binaries to the path easily accessible in the next step and rename them to gitea
|
||||||
COPY --chmod=755 tmp-bin/release/forgejo-$TAG-linux-amd64 "${OUT}/linux/amd64/gitea"
|
COPY --chmod=755 ./dist/release/forgejo-$TAG-linux-amd64 "${OUT}/linux/amd64/gitea"
|
||||||
COPY --chmod=755 tmp-bin/release/forgejo-$TAG-linux-arm64 "${OUT}/linux/arm64/gitea"
|
COPY --chmod=755 ./dist/release/forgejo-$TAG-linux-arm64 "${OUT}/linux/arm64/gitea"
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
|
|
||||||
|
@ -49,25 +40,24 @@ RUN echo "setting up git" && \
|
||||||
export ENV2INI="environment-to-ini" && \
|
export ENV2INI="environment-to-ini" && \
|
||||||
export GOFILE="contrib/$ENV2INI/$ENV2INI.go" && \
|
export GOFILE="contrib/$ENV2INI/$ENV2INI.go" && \
|
||||||
echo "compiling for linux/amd64" && \
|
echo "compiling for linux/amd64" && \
|
||||||
bash -c 'GOOS=linux GOARCH=amd64 go build -o "${OUT}/linux/amd64/$ENV2INI" "${GOFILE}"' && \
|
GOOS=linux GOARCH=amd64 go build -o "${OUT}/linux/amd64/$ENV2INI" "${GOFILE}" && \
|
||||||
echo "compiling for linux/arm64" && \
|
echo "compiling for linux/arm64" && \
|
||||||
bash -c 'GOOS=linux GOARCH=arm64 go build -o "${OUT}/linux/arm64/$ENV2INI "${GOFILE}"' && \
|
GOOS=linux GOARCH=arm64 go build -o "${OUT}/linux/arm64/$ENV2INI "${GOFILE}" && \
|
||||||
cd / && \
|
cd / && \
|
||||||
echo "Copying future root addons" && \
|
echo "Copying future root addons" && \
|
||||||
cp -r /build"${DR}/* "${DR}/ && \
|
cp -r /build"${DR}/* "${DR}/ && \
|
||||||
echo "Fixing permissions" && \
|
echo "Fixing permissions" && \
|
||||||
chmod 755 "${DR}/usr/bin/entrypoint "${DR}/usr/local/bin/gitea "${DR}/etc/s6/gitea/* "${DR}/etc/s6/openssh/* "${DR}/etc/s6/.s6-svscan/* && \
|
chmod 755 "${DR}/usr/bin/entrypoint "${DR}/usr/local/bin/gitea "${DR}/etc/s6/gitea/* "${DR}/etc/s6/openssh/* "${DR}/etc/s6/.s6-svscan/* && \
|
||||||
echo "removing git repo" && \
|
echo "removing git repo" && \
|
||||||
rm -Rf /build && \
|
rm -Rf /build
|
||||||
echo "removing go cached files" && \
|
|
||||||
rm -Rf "$(go env GOCACHE)" && \
|
|
||||||
rm -Rf "$(go env GOROOT)/pkg" && \
|
|
||||||
rm -Rf "$(go env GOPATH)/pkg"
|
|
||||||
|
|
||||||
# Main build
|
# Main build
|
||||||
FROM alpine:3.17.0
|
FROM codeberg.org/forgejo/alpine:3.17.0
|
||||||
LABEL maintainer="contact@forgejo.org"
|
LABEL maintainer="contact@forgejo.org"
|
||||||
|
|
||||||
|
ARG TARGETPLATFORM
|
||||||
|
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
||||||
|
|
||||||
EXPOSE 22 3000
|
EXPOSE 22 3000
|
||||||
|
|
||||||
RUN apk --no-cache add \
|
RUN apk --no-cache add \
|
||||||
|
@ -104,14 +94,8 @@ VOLUME ["/data"]
|
||||||
ENTRYPOINT ["/usr/bin/entrypoint"]
|
ENTRYPOINT ["/usr/bin/entrypoint"]
|
||||||
CMD ["/bin/s6-svscan", "/etc/s6"]
|
CMD ["/bin/s6-svscan", "/etc/s6"]
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG OUT "/out-bins"
|
||||||
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
|
ARG DR "/docker/root"
|
||||||
|
|
||||||
# Shorthands for easy use and ease of replacement
|
|
||||||
ARG OUT
|
|
||||||
ENV OUT "${OUT:-/out-bins}"
|
|
||||||
ARG DR
|
|
||||||
ENV DR "${DR:-"/docker/root"}"
|
|
||||||
|
|
||||||
COPY --from=build-env "${DR}" /
|
COPY --from=build-env "${DR}" /
|
||||||
COPY --from=build-env --chmod=755 "${OUT}/$TARGETPLATFORM/*" /app/gitea/
|
COPY --from=build-env --chmod=755 "${OUT}/$TARGETPLATFORM/*" /app/gitea/
|
||||||
|
|
Loading…
Add table
Reference in a new issue