Compare commits

...

39 Commits

Author SHA1 Message Date
gapodo 118d90b39e e
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:48:42 +01:00
gapodo ae8c0b9059 d
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:39:19 +01:00
gapodo 88dd005a9a c
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:34:11 +01:00
gapodo 5b4108825e b
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:30:10 +01:00
gapodo d3b788b1ea a
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:26:57 +01:00
gapodo 763f42f684 z
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:25:55 +01:00
gapodo 91be6bb367 y
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:20:32 +01:00
gapodo 1f3f7bf9c6 x
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 02:04:01 +01:00
gapodo 545d0040e0 fix ordering
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:38:48 +01:00
gapodo 9d1ca7c8d7 better?
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:31:01 +01:00
gapodo 350f63b93e a
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:23:06 +01:00
gapodo 65b2f13d7c retry
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:19:01 +01:00
gapodo ed76f13438 more missing quotes
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:14:34 +01:00
gapodo adc622cee9 fixed missing quote
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:10:25 +01:00
gapodo 1310f11502 better vars
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 01:05:41 +01:00
gapodo 0b0c65e797 retest 2022-12-08 00:59:21 +01:00
gapodo 86875a760e next
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 00:36:55 +01:00
gapodo 00751ec6ef test
ci/woodpecker/push/release-version Pipeline failed Details
2022-12-08 00:32:11 +01:00
gapodo ecff55b1f7 26
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-08 00:22:25 +01:00
gapodo 0a6a9920b1 next 2022-12-08 00:09:45 +01:00
gapodo dd8ba9a40f x
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 23:36:02 +01:00
gapodo 9986443830 retest
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 23:11:11 +01:00
gapodo d132dbe58e fixed it?
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 22:57:03 +01:00
gapodo 3e929d69fc y
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 22:44:38 +01:00
gapodo 2630962534 x
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 22:41:59 +01:00
gapodo 44f633a09d use docker upstream images...
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 22:26:24 +01:00
gapodo 19fe24ee0b please?
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 22:15:51 +01:00
gapodo 4a7876313b fixed?
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 22:10:38 +01:00
gapodo ab3628e039 another one
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 21:52:06 +01:00
gapodo 1460aa916c retry
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 21:23:20 +01:00
gapodo 8c43879989 redo
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 20:36:57 +01:00
gapodo 462718b497 next try
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 20:28:38 +01:00
gapodo e23cef61e8 retry with debugging
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 20:10:41 +01:00
gapodo 35c0faccb7 docker relative sucks
ci/woodpecker/push/compliance-and-tests Pipeline is pending Details
ci/woodpecker/push/release-version Pipeline is pending Details
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 20:04:00 +01:00
gapodo 48a3917874 retry...
ci/woodpecker/push/compliance-and-tests Pipeline is pending Details
ci/woodpecker/push/release-version Pipeline is pending Details
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 19:35:39 +01:00
gapodo 92b3ab19de fix?
ci/woodpecker/push/compliance-and-tests Pipeline is pending Details
ci/woodpecker/push/release-version Pipeline is pending Details
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 19:17:32 +01:00
gapodo 2acacbeb13 quick rerun
ci/woodpecker/push/compliance-and-tests Pipeline is pending Details
ci/woodpecker/push/release-version Pipeline is pending Details
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 18:12:23 +01:00
gapodo cc58bf3928 retest
ci/woodpecker/push/compliance-and-tests Pipeline is pending Details
ci/woodpecker/push/release-version Pipeline is pending Details
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 17:58:03 +01:00
gapodo 5e0cff5eb6 Quick test
ci/woodpecker/push/compliance-and-tests Pipeline is pending Details
ci/woodpecker/push/release-version Pipeline is pending Details
ci/woodpecker/tag/compliance-and-tests Pipeline was successful Details
ci/woodpecker/tag/release-version Pipeline failed Details
2022-12-07 17:40:58 +01:00
6 changed files with 251 additions and 181 deletions

View File

@ -1,32 +0,0 @@
platform: linux/amd64
workspace:
base: /go
path: src/codeberg/gitea
pipeline:
deps-backend:
image: golang:1.19
pull: true
commands:
- make deps-backend
security-check:
image: golang:1.19
pull: true
commands:
- make security-check
lint-backend:
image: gitea/test_env:linux-amd64
pull: true
environment:
- TAGS=bindata sqlite sqlite_unlock_notify
- GOSUMDB=sum.golang.org
commands:
- make lint-backend
checks-backend:
image: golang:1.19
commands:
- make --always-make checks-backend

View File

@ -1,28 +0,0 @@
platform: linux/amd64
depends_on:
- testing-amd64
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
publish:
image: woodpeckerci/plugin-docker-buildx
pull: true
settings:
platforms: linux/amd64
registry:
from_secret: domain
tag: ${CI_COMMIT_TAG##v}
repo: ${CI_REPO_LINK##https://}
password:
from_secret: releaseteamtoken
username:
from_secret: releaseteamuser
when:
event: tag

View File

@ -1,65 +1,135 @@
platform: linux/amd64
depends_on:
- testing-amd64
# depends_on:
# - compliance-and-tests
workspace:
base: /source
path: /
variables:
- &git_image 'docker:git'
- &golang_image 'golang:1.19'
- &node_image 'node:18'
- &xgo_image 'techknowlogick/xgo:go-1.19.x'
- &buildx_plugin_image 'woodpeckerci/plugin-docker-buildx'
- &gpgsign_plugin_image 'plugins/gpgsign:1'
# Docker and XGO platforms may vary in name (arm/v6/v7,...), please make sure,
# that all platforms listed in docker_platforms are also in make_platforms
# for the mapping look at docker/map-binaries.sh
- &make_platforms 'linux/amd64,linux/arm64'
#- &docker_platforms 'linux/amd64,linux/arm64'
# Just building docker for amd64, as codeberg.org/forgejo/alpine:3.17 does not provide arm64
- &docker_platforms 'linux/amd64,linux/arm64'
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
# fetch-tags:
# image: *git_image
# pull: true
# commands:
# - git config --add safe.directory '*'
# - git fetch --tags --force
deps-frontend:
image: node:18
pull: true
commands:
- make deps-frontend
# deps-frontend:
# image: *node_image
# pull: true
# commands:
# - make deps-frontend
deps-backend:
image: golang:1.19
pull: true
commands:
- make deps-backend
# deps-backend:
# image: *golang_image
# pull: true
# commands:
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
# - make deps-backend
# secrets:
# - goproxy_override
static:
image: techknowlogick/xgo:go-1.19.x
# build-static:
# image: *xgo_image
# pull: true
# commands:
# - test "$${GOPROXY_OVERRIDE-}" != "" && export GOPROXY="$${GOPROXY_OVERRIDE}"
# - echo "installing nodejs"
# - curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
# - export PATH=$PATH:$GOPATH/bin
# - echo "building forgejo"
# - make CI=true LINUX_ARCHS=$${LINUX_ARCHS} release
# environment:
# TAGS: bindata sqlite sqlite_unlock_notify
# DEBIAN_FRONTEND: noninteractive
# LINUX_ARCHS: *make_platforms
# secrets:
# - goproxy_override
# gpg-sign:
# image: *gpgsign_plugin_image
# pull: true
# settings:
# detach_sign: true
# excludes:
# - "dist/release/*.sha256"
# files:
# - "dist/release/*"
# key:
# from_secret: releaseteamgpg
# when:
# event: tag
# release:
# image: *golang_image
# commands:
# - curl -sL https://dl.gitea.io/tea/0.9.0/tea-0.9.0-linux-amd64 > /bin/tea && chmod +x /bin/tea
# - REMOTE=$(echo $CI_REPO_LINK | sed -e 's|.*://||' -e 's|/.*||')
# - GITEA_SERVER_URL=$CI_REPO_LINK GITEA_SERVER_TOKEN=$RELEASETEAMTOKEN tea login add --name $RELEASETEAMUSER --url $REMOTE
# - ASSETS=$(ls dist/release/* | sed -e 's/^/-a /')
# - echo "$${CI_COMMIT_TAG##v}" | grep -qi '\-rc' && export RELEASETYPE="--prerelease" && echo "Uploading as Pre-Release"
# - echo "$${CI_COMMIT_TAG##v}" | grep -qi '\-test' && export RELEASETYPE="--draft" && echo "Uploading as Draft"
# - test $${RELEASETYPE+false} || echo "Uploading as Stable"
# - tea release create $ASSETS --tag $CI_COMMIT_TAG --title $CI_COMMIT_TAG $${RELEASETYPE}
# when:
# event: tag
# secrets:
# - releaseteamtoken
# - releaseteamuser
debug:
image: *golang_image
pull: true
commands:
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get -qqy install nodejs
- export PATH=$PATH:$GOPATH/bin
- make CI=true LINUX_ARCHS=linux/amd64,linux/arm64 release
environment:
TAGS: bindata sqlite sqlite_unlock_notify
DEBIAN_FRONTEND: noninteractive
gpg-sign:
image: plugins/gpgsign:1
pull: true
settings:
detach_sign: true
excludes:
- "dist/release/*.sha256"
files:
- "dist/release/*"
key:
from_secret: releaseteamgpg
release:
image: golang:1.19
TAG: ${CI_COMMIT_TAG:-main}
commands:
- curl -sL https://dl.gitea.io/tea/0.9.0/tea-0.9.0-linux-amd64 > /bin/tea && chmod +x /bin/tea
- REMOTE=$(echo $CI_REPO_LINK | sed -e 's|.*://||' -e 's|/.*||')
- GITEA_SERVER_URL=$CI_REPO_LINK GITEA_SERVER_TOKEN=$RELEASETEAMTOKEN tea login add --name $RELEASETEAMUSER --url $REMOTE
- ASSETS=$(ls dist/release/* | sed -e 's/^/-a /')
- tea release create $ASSETS --tag $CI_COMMIT_TAG --title $CI_COMMIT_TAG
when:
event: tag
- env | grep -vi drone | sort -h
- mkdir -p /source/dist/release
- touch /source/dist/release/forgejo-$${TAG##v}-linux-arm64
- touch /source/dist/release/forgejo-$${TAG##v}-linux-amd64
- mkdir tmp-bin
- cp -r dist/* tmp-bin/
- ls -la tmp-bin/*
build-docker:
image: *buildx_plugin_image
pull: true
secrets:
- releaseteamtoken
- releaseteamuser
- source: goproxy_override
target: goproxy
settings:
dockerfile: Dockerfile.ci
platforms: *docker_platforms
registry:
from_secret: domain
tag: ${CI_COMMIT_TAG##v}
repo: ${CI_REPO_LINK##https://}
build_args:
- TAG=${CI_COMMIT_TAG##v}
build_args_from_env:
- CI_REPO_CLONE_URL
- CI_COMMIT_SHA
- GOPROXY
password:
from_secret: releaseteamtoken
username:
from_secret: releaseteamuser
# when:
# event: tag

View File

@ -1,63 +0,0 @@
platform: linux/amd64
depends_on:
- compliance
workspace:
base: /go
path: src/codeberg/gitea
pipeline:
fetch-tags:
image: docker:git
pull: true
commands:
- git config --add safe.directory '*'
- git fetch --tags --force
deps-backend:
image: golang:1.19
pull: true
commands:
- make deps-backend
tag-pre-condition:
image: drone/git
pull: true
commands:
- git update-ref refs/heads/tag_test ${CI_COMMIT_SHA}
prepare-test-env:
image: gitea/test_env:linux-amd64
pull: true
commands:
- ./build/test-env-prepare.sh
build:
image: gitea/test_env:linux-amd64
environment:
- GOSUMDB=sum.golang.org
- TAGS=bindata sqlite sqlite_unlock_notify
commands:
- su gitea -c './build/test-env-check.sh'
- su gitea -c 'make backend'
unit-test:
image: gitea/test_env:linux-amd64
environment:
- TAGS=bindata sqlite sqlite_unlock_notify
- RACE_ENABLED=true
secrets:
- github_read_token
commands:
- su gitea -c 'make unit-test-coverage test-check'
# test-sqlite:
# image: gitea/test_env:linux-amd64
# 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'

123
Dockerfile.ci Normal file
View File

@ -0,0 +1,123 @@
FROM --platform=$BUILDPLATFORM golang:1.19 AS build-env
ARG GOPROXY
ENV GOPROXY "${GOPROXY:-direct}"
ARG TAG
ENV TAG ${TAG:-main}
ARG CI_COMMIT_SHA
ENV CI_COMMIT_SHA "${CI_COMMIT_SHA}"
ARG CI_REPO_CLONE_URL
ENV CI_REPO_CLONE_URL "${CI_REPO_CLONE_URL}"
# Shorthands for easy use and ease of replacement
ARG OUT
ENV OUT "${OUT:-/out-bins}"
ARG DR
ENV DR "${DR:-/docker/root}"
# 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 tmp-bin/release/forgejo-$TAG-linux-arm64 "${OUT}/linux/arm64/gitea"
WORKDIR /
# Check vars and create directories
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) && \
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/arm64" && \
echo "Creating build dir" && \
mkdir /build && \
cd /build && \
echo "setting up git" && \
# quiet down git
git config --global init.defaultBranch dummy && \
git config --global advice.detachedHead false && \
git init && \
git remote add origin "${CI_REPO_CLONE_URL}" && \
# shallow clone as we just need the current data, keeps the "clone" really small
git fetch --depth 1 origin ${CI_COMMIT_SHA} && \
git checkout FETCH_HEAD && \
export ENV2INI="environment-to-ini" && \
export GOFILE="contrib/$ENV2INI/$ENV2INI.go" && \
echo "compiling for linux/amd64" && \
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "${OUT}/linux/amd64/$ENV2INI" "${GOFILE}" && \
echo "compiling for linux/arm64" && \
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o "${OUT}/linux/arm64/$ENV2INI" "${GOFILE}" && \
cd / && \
ls -la /* && \
echo "Creating docker root prep dir ${DR}" && \
mkdir -p "${DR}" && \
echo "Copying future root addons" && \
ls -la "/build/docker/" && \
ls -la "/build/docker/root/*" && \
cp -a "/build/docker/root/." "${DR}/" && \
ls -la "${DR}/*" && \
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/*" && \
echo "removing git repo" && \
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
FROM alpine:3.17.0
LABEL maintainer="contact@forgejo.org"
EXPOSE 22 3000
RUN apk --no-cache add \
bash \
ca-certificates \
curl \
gettext \
git \
linux-pam \
openssh \
s6 \
sqlite \
su-exec \
gnupg \
tzdata
RUN addgroup \
-S -g 1000 \
git && \
adduser \
-S -H -D \
-h /data/git \
-s /bin/bash \
-u 1000 \
-G git \
git && \
echo "git:*" | chpasswd -e
ENV USER git
ENV GITEA_CUSTOM /data/gitea
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/bin/s6-svscan", "/etc/s6"]
ARG TARGETPLATFORM
ENV TARGETPLATFORM=${TARGETPLATFORM:-linux/amd64}
# 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 --chmod=755 "${OUT}/$TARGETPLATFORM/*" /app/gitea/
# unsure it it's better to just use 2 copys and bring it to the correct place
# or ln -s (had mixed results usually ln -s makes a smaller end result)
RUN ln -s /app/gitea/environment-to-ini /usr/local/bin/environment-to-ini

View File

@ -790,17 +790,17 @@ release-check: | $(DIST_DIRS)
.PHONY: release-compress
release-compress: | $(DIST_DIRS)
cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PAGAGE) -k -9 $${file}; done;
# cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && $(GO) run $(GXZ_PAGAGE) -k -9 $${file}; done;
.PHONY: release-sources
release-sources: | $(DIST_DIRS)
echo $(VERSION) > $(STORED_VERSION_FILE)
# bsdtar needs a ^ to prevent matching subdirectories
$(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
# use transform to a add a release-folder prefix; in bsdtar the transform parameter equivalent is -s
$(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./forgejo-src-$(VERSION)/'" || echo "--transform 's|^./|forgejo-src-$(VERSION)/|'"))
tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/forgejo-src-$(VERSION).tar.gz .
rm -f $(STORED_VERSION_FILE)
# echo $(VERSION) > $(STORED_VERSION_FILE)
## bsdtar needs a ^ to prevent matching subdirectories
# $(eval EXCL := --exclude=$(shell tar --help | grep -q bsdtar && echo "^")./)
## use transform to a add a release-folder prefix; in bsdtar the transform parameter equivalent is -s
# $(eval TRANSFORM := $(shell tar --help | grep -q bsdtar && echo "-s '/^./forgejo-src-$(VERSION)/'" || echo "--transform 's|^./|forgejo-src-$(VERSION)/|'"))
# tar $(addprefix $(EXCL),$(TAR_EXCLUDES)) $(TRANSFORM) -czf $(DIST)/release/forgejo-src-$(VERSION).tar.gz .
# rm -f $(STORED_VERSION_FILE)
.PHONY: release-docs
release-docs: | $(DIST_DIRS) docs