diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..f2ded9f --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,194 @@ +local architectures = ["amd64","arm64"]; + +local version_6_0_0 = +{ + tag: "6.0.0", + additional_tags: ["6.0","6","stable"], + dir: "6.0", + +}; + +local version_5_1_0 = +{ + tag: "5.1.0", + additional_tags: ["5","5.1","old-stable","latest"], + dir: "5.1" +}; + + +local versions = [version_6_0_0, version_5_1_0]; + + +local build_steps(versions,arch) = [ + { + name: "Build " + version.tag, + image: "quay.io/buildah/stable", + privileged: true, + volumes: + { + name: "fedhq-ca-crt", + path: "/etc/ssl/certs2/" + + }, + commands: [ + "scripts/setupEnvironment.sh", + "cd " + version.dir + ";" + 'buildah bud --network host -t "registry.cloud.federationhq.de/redmine:' +version.tag + "-" + arch + '" --arch ' + arch, + 'buildah push --all registry.cloud.federationhq.de/redmine:'+version.tag + "-" + arch + + ] + } + for version in versions +]; + +local build_pipelines(architectures) = [ + { + kind: "pipeline", + type: "kubernetes", + name: "build-"+arch, + platform: { + arch: arch + }, + volumes: + [ + { + name: "fedhq-ca-crt", + config_map: + { + name: "fedhq-ca-crt", + default_mode: 420, + optional: false + }, + + } + ], + node_selector: + { + 'kubernetes.io/arch': arch, + 'federationhq.de/compute': true + }, + steps: build_steps(versions, arch), + } + for arch in architectures +]; + + + +local push_pipelines(versions, architectures) = [ + { + kind: "pipeline", + type: "kubernetes", + name: "push-"+version.tag, + platform: { + arch: "amd64" + }, + volumes: + [ + { + name: "fedhq-ca-crt", + config_map: + { + name: "fedhq-ca-crt", + default_mode: 420, + optional: false + }, + + } + ], + node_selector: + { + 'kubernetes.io/arch': "amd64", + 'federationhq.de/compute': true + }, + depends_on: [ + "build-"+arch + for arch in architectures + ], + steps: + [ + "scripts/setupEnvironment.sh", + "buildah manifest create redmine:"+version.tag, + ] + + + [ + "buildah manifest add redmine:" + version.tag + " registry.cloud.federationhq.de/redmine:"+version.tag + "-" + arch + for arch in architectures + ] + + + [ + "buildah manifest push --all redmine:"+version.tag + " docker://registry.cloud.federationhq.de/redmine:"+tag + for tag in [version.tag]+version.additional_tags + ] + + + [ + "buildah login -u $${USERNAME} -p $${PASSWORD} registry.hub.docker.com", + ] + + + [ + "buildah manifest push --all redmine:"+version.tag + " docker://registry.hub.docker.com/byterazor/redmine:"+tag + for tag in [version.tag]+version.additional_tags + ], + } + for version in versions +]; + +local push_github = { + kind: "pipeline", + type: "kubernetes", + name: "mirror-to-github", + node_selector: { + "kubernetes.io/arch": "amd64", + "federationhq.de/location": "Blumendorf", + "federationhq.de/compute": true + }, + steps: [ + { + name: "github-mirror", + image: "registry.cloud.federationhq.de/drone-github-mirror:latest", + pull: "always", + settings: { + GH_TOKEN: { + from_secret: "GH_TOKEN" + }, + GH_REPO: "byterazor/container-redmine", + GH_REPO_DESC: "container for running redmine", + GH_REPO_HOMEPAGE: "https://gitea.federationhq.de/Container/redmine" + } + } + ], + depends_on: + [ + "push-"+version.tag + for version in versions + ] +}; + + +[ + build_pipelines(architectures) + push_pipelines(versions,architectures) + [push_github] + + [ +{ + kind: "secret", + name: "GH_TOKEN", + get:{ + path: "github", + name: "token" + } +}, +{ + kind: "secret", + name: "username", + get:{ + path: "docker", + name: "username" + } +}, +{ + kind: "secret", + name: "password", + get:{ + path: "docker", + name: "secret" + } +} + ] +] \ No newline at end of file diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index c77a3d8..0000000 --- a/.drone.yml +++ /dev/null @@ -1,144 +0,0 @@ -kind: pipeline -type: kubernetes -name: build-amd64 -platform: - arch: amd64 -node_selector: - kubernetes.io/arch: amd64 - federationhq.de/compute: true - -volumes: -- name: fedhq-ca-crt - config_map: - name: fedhq-ca-crt - default_mode: 420 # same as 644 in octal, or u+w,a+r - optional: false - -steps: - - name: build amd64 - image: quay.io/buildah/stable - privileged: true - volumes: - - name: fedhq-ca-crt - path: /etc/ssl/certs2/ - commands: - - scripts/setupEnvironment.sh - - buildah bud --network host -t "registry.cloud.federationhq.de/redmine:latest-amd64" --arch amd64 . - - buildah push --all registry.cloud.federationhq.de/redmine:latest-amd64 ---- -kind: pipeline -type: kubernetes -name: build-arm64 -platform: - arch: arm64 -node_selector: - kubernetes.io/arch: arm64 - federationhq.de/compute: true - -volumes: -- name: fedhq-ca-crt - config_map: - name: fedhq-ca-crt - default_mode: 420 # same as 644 in octal, or u+w,a+r - optional: false - -steps: - - name: build arm64 - image: quay.io/buildah/stable - privileged: true - volumes: - - name: fedhq-ca-crt - path: /etc/ssl/certs2/ - commands: - - scripts/setupEnvironment.sh - - buildah bud --network host -t "registry.cloud.federationhq.de/redmine:latest-arm64" --arch arm64 . - - buildah push --all registry.cloud.federationhq.de/redmine:latest-arm64 ---- -kind: pipeline -type: kubernetes -name: push -node_selector: - kubernetes.io/arch: amd64 - federationhq.de/compute: true - -volumes: -- name: fedhq-ca-crt - config_map: - name: fedhq-ca-crt - default_mode: 420 # same as 644 in octal, or u+w,a+r - optional: false - -steps: - - name: push - image: quay.io/buildah/stable - privileged: true - environment: - USERNAME: - from_secret: username - PASSWORD: - from_secret: password - volumes: - - name: fedhq-ca-crt - path: /etc/ssl/certs2/ - commands: - - scripts/setupEnvironment.sh - - buildah manifest create redmine:latest registry.cloud.federationhq.de/redmine:latest-arm64 registry.cloud.federationhq.de/redmine:latest-amd64 - - buildah manifest push --all redmine:latest docker://registry.cloud.federationhq.de/redmine:latest - - buildah login -u $${USERNAME} -p $${PASSWORD} registry.hub.docker.com - - buildah manifest push --all redmine:latest docker://registry.hub.docker.com/byterazor/redmine:latest - - buildah manifest rm redmine:latest - - name: push readme - image: byterazor/drone-docker-readme-push:latest - settings: - REPOSITORY_NAME: byterazor/redmine - FILENAME: README.md - USERNAME: - from_secret: username - PASSWORD: - from_secret: password -depends_on: - - build-amd64 - - build-arm64 - ---- - -kind: pipeline -type: kubernetes -name: mirror-to-github -node_selector: - kubernetes.io/arch: amd64 - federationhq.de/location: Blumendorf - federationhq.de/compute: true -steps: - - name: github-mirror - image: registry.cloud.federationhq.de/drone-github-mirror:latest - pull: always - settings: - GH_TOKEN: - from_secret: GH_TOKEN - GH_REPO: "byterazor/container-redmine" - GH_REPO_DESC: "container for running redmine" - GH_REPO_HOMEPAGE: "https://gitea.federationhq.de/Container/redmine" -depends_on: - - push - ---- -kind: secret -name: GH_TOKEN -get: - path: github - name: token - ---- -kind: secret -name: username -get: - path: docker - name: username - ---- -kind: secret -name: password -get: - path: docker - name: secret