2019-07-27 16:03:05 +02:00
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- build docker
|
2020-02-25 21:59:39 +01:00
|
|
|
- manifest
|
2019-07-27 16:03:05 +02:00
|
|
|
|
2020-05-08 22:53:30 +02:00
|
|
|
.build: &build
|
2019-07-27 16:03:05 +02:00
|
|
|
stage: build
|
2019-07-27 16:15:45 +02:00
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .cache
|
2019-07-27 16:03:05 +02:00
|
|
|
before_script:
|
2019-07-27 16:15:45 +02:00
|
|
|
- mkdir -p .cache
|
|
|
|
- export GOPATH="$CI_PROJECT_DIR/.cache"
|
2020-10-19 01:19:34 +02:00
|
|
|
- export GOCACHE="$CI_PROJECT_DIR/.cache/build"
|
2021-08-15 21:53:06 +02:00
|
|
|
- export GO_LDFLAGS="-s -w -linkmode external -extldflags -static -X main.Tag=$CI_COMMIT_TAG -X main.Commit=$CI_COMMIT_SHA -X 'main.BuildTime=`date '+%b %_d %Y, %H:%M:%S'`'"
|
2019-07-27 16:03:05 +02:00
|
|
|
script:
|
2020-06-03 19:32:53 +02:00
|
|
|
- go build -ldflags "$GO_LDFLAGS" -o mautrix-whatsapp
|
2021-11-06 14:54:27 +01:00
|
|
|
- sha256sum mautrix-whatsapp | tee mautrix-whatsapp.sha256sum
|
2019-07-27 16:03:05 +02:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2020-02-25 22:13:19 +01:00
|
|
|
- mautrix-whatsapp
|
2021-11-06 14:54:27 +01:00
|
|
|
- mautrix-whatsapp.sha256sum
|
2020-02-25 21:59:39 +01:00
|
|
|
- example-config.yaml
|
|
|
|
|
2020-05-08 22:53:30 +02:00
|
|
|
.build-docker: &build-docker
|
2019-07-27 16:03:05 +02:00
|
|
|
image: docker:stable
|
|
|
|
stage: build docker
|
|
|
|
before_script:
|
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
|
|
|
script:
|
|
|
|
- docker pull $CI_REGISTRY_IMAGE:latest || true
|
2020-10-19 14:36:40 +02:00
|
|
|
- docker build --pull --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-$DOCKER_ARCH . --file Dockerfile.ci
|
2020-05-08 22:53:30 +02:00
|
|
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-$DOCKER_ARCH
|
|
|
|
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-$DOCKER_ARCH
|
|
|
|
|
|
|
|
build amd64:
|
|
|
|
<<: *build
|
2020-10-19 14:36:40 +02:00
|
|
|
image: dock.mau.dev/tulir/gomuks-build-docker:linux-amd64
|
2020-05-08 22:53:30 +02:00
|
|
|
|
|
|
|
build arm64:
|
|
|
|
<<: *build
|
2020-10-19 14:36:40 +02:00
|
|
|
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm64
|
|
|
|
|
|
|
|
build arm:
|
|
|
|
<<: *build
|
|
|
|
image: dock.mau.dev/tulir/gomuks-build-docker:linux-arm
|
2020-05-08 22:53:30 +02:00
|
|
|
|
|
|
|
build docker amd64:
|
|
|
|
<<: *build-docker
|
|
|
|
tags:
|
|
|
|
- amd64
|
|
|
|
dependencies:
|
|
|
|
- build amd64
|
2020-07-14 22:22:52 +02:00
|
|
|
needs:
|
|
|
|
- build amd64
|
2020-05-08 22:53:30 +02:00
|
|
|
variables:
|
|
|
|
DOCKER_ARCH: amd64
|
2020-11-11 22:19:19 +01:00
|
|
|
after_script:
|
|
|
|
- |
|
2021-11-01 17:30:06 +01:00
|
|
|
if [[ "$CI_COMMIT_BRANCH" == "master" && "$CI_JOB_STATUS" == "success" ]]; then
|
2021-09-17 18:21:22 +02:00
|
|
|
apk add --update curl jq
|
2020-11-11 22:19:19 +01:00
|
|
|
rm -rf /var/cache/apk/*
|
2021-09-17 18:21:22 +02:00
|
|
|
|
|
|
|
jq -n '
|
|
|
|
{
|
|
|
|
password: env.BEEPER_DEV_ADMIN_NIGHTLY_PASS,
|
|
|
|
bridge: env.BEEPER_BRIDGE_TYPE,
|
|
|
|
image: "\(env.CI_REGISTRY_IMAGE):\(env.CI_COMMIT_SHA)-amd64",
|
|
|
|
channel: "STABLE"
|
|
|
|
}
|
|
|
|
' | curl "$BEEPER_DEV_ADMIN_API_URL" -H "Content-Type: application/json" -d @-
|
|
|
|
|
2022-04-19 03:26:05 +02:00
|
|
|
jq -n '
|
|
|
|
{
|
|
|
|
password: env.BEEPER_DEV_ADMIN_NIGHTLY_PASS,
|
|
|
|
bridge: env.BEEPER_BRIDGE_TYPE,
|
|
|
|
image: "\(env.CI_REGISTRY_IMAGE):\(env.CI_COMMIT_SHA)-amd64",
|
|
|
|
channel: "NIGHTLY"
|
|
|
|
}
|
|
|
|
' | curl "$BEEPER_DEV_ADMIN_API_URL" -H "Content-Type: application/json" -d @-
|
|
|
|
|
2021-09-17 18:21:22 +02:00
|
|
|
jq -n '
|
|
|
|
{
|
|
|
|
password: env.BEEPER_PROD_ADMIN_NIGHTLY_PASS,
|
|
|
|
bridge: env.BEEPER_BRIDGE_TYPE,
|
|
|
|
image: "\(env.CI_REGISTRY_IMAGE):\(env.CI_COMMIT_SHA)-amd64",
|
|
|
|
channel: "INTERNAL",
|
2021-11-03 09:56:25 +01:00
|
|
|
deployNext: true
|
2021-09-17 18:21:22 +02:00
|
|
|
}
|
|
|
|
' | curl "$BEEPER_PROD_ADMIN_API_URL" -H "Content-Type: application/json" -d @-
|
2020-11-11 22:19:19 +01:00
|
|
|
fi
|
2019-07-27 16:03:05 +02:00
|
|
|
|
2020-02-25 21:59:39 +01:00
|
|
|
build docker arm64:
|
2020-05-08 22:53:30 +02:00
|
|
|
<<: *build-docker
|
2020-02-25 21:59:39 +01:00
|
|
|
tags:
|
|
|
|
- arm64
|
2020-05-08 22:53:30 +02:00
|
|
|
dependencies:
|
|
|
|
- build arm64
|
2020-07-14 22:22:52 +02:00
|
|
|
needs:
|
|
|
|
- build arm64
|
2020-05-08 22:53:30 +02:00
|
|
|
variables:
|
|
|
|
DOCKER_ARCH: arm64
|
2019-07-27 16:03:05 +02:00
|
|
|
|
2020-02-25 21:59:39 +01:00
|
|
|
manifest:
|
|
|
|
stage: manifest
|
2020-07-14 22:22:52 +02:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
2019-07-27 16:03:05 +02:00
|
|
|
before_script:
|
2020-02-25 21:59:39 +01:00
|
|
|
- "mkdir -p $HOME/.docker && echo '{\"experimental\": \"enabled\"}' > $HOME/.docker/config.json"
|
2019-07-27 16:03:05 +02:00
|
|
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
2020-07-14 22:22:52 +02:00
|
|
|
needs:
|
|
|
|
- build docker amd64
|
|
|
|
- build docker arm64
|
2019-07-27 16:03:05 +02:00
|
|
|
script:
|
2020-02-25 21:59:39 +01:00
|
|
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64
|
|
|
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
|
2020-06-03 20:11:48 +02:00
|
|
|
- if [ "$CI_COMMIT_BRANCH" = "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:latest $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:latest; fi
|
|
|
|
- if [ "$CI_COMMIT_BRANCH" != "master" ]; then docker manifest create $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64 && docker manifest push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; fi
|
2020-02-25 21:59:39 +01:00
|
|
|
- docker rmi $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-amd64 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA-arm64
|