From f064fb98ed5d58e4afae8574f57612029c183f5e Mon Sep 17 00:00:00 2001 From: Mirco Date: Mon, 16 Oct 2023 18:04:35 +0200 Subject: [PATCH] [Skip-CI] Updated build.py, nextcloud version 27 --- .gitlab-ci.yml | 147 +++++++------- build.py | 179 ++++++++++++++++++ infrastructure/backup/build.py | 54 ++++++ .../image/Dockerfile | 0 .../image/resources/backup.sh | 0 .../image/resources/end-maintenance.sh | 0 .../resources/entrypoint-start-and-wait.sh | 0 .../image/resources/entrypoint.sh | 0 .../image/resources/init.sh | 0 .../image/resources/install.sh | 0 .../image/resources/list-snapshots.sh | 0 .../image/resources/restore.sh | 0 .../image/resources/start-maintenance.sh | 0 .../{docker-backup => backup}/test/Dockerfile | 0 .../test/serverspec.edn | 0 infrastructure/docker-backup/build.py | 52 ----- infrastructure/docker-nextcloud/build.py | 52 ----- infrastructure/nextcloud/build.py | 53 ++++++ .../image/Dockerfile | 2 +- .../image/resources/entrypoint.sh | 0 .../image/resources/install-debug.sh | 0 .../image/resources/install.sh | 0 .../image/resources/memory-limit.ini | 0 .../image/resources/upload-max-limit.ini | 0 .../test/Dockerfile | 0 .../test/serverspec.edn | 0 26 files changed, 356 insertions(+), 183 deletions(-) create mode 100644 build.py create mode 100644 infrastructure/backup/build.py rename infrastructure/{docker-backup => backup}/image/Dockerfile (100%) rename infrastructure/{docker-backup => backup}/image/resources/backup.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/end-maintenance.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/entrypoint-start-and-wait.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/entrypoint.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/init.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/install.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/list-snapshots.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/restore.sh (100%) rename infrastructure/{docker-backup => backup}/image/resources/start-maintenance.sh (100%) rename infrastructure/{docker-backup => backup}/test/Dockerfile (100%) rename infrastructure/{docker-backup => backup}/test/serverspec.edn (100%) delete mode 100644 infrastructure/docker-backup/build.py delete mode 100644 infrastructure/docker-nextcloud/build.py create mode 100644 infrastructure/nextcloud/build.py rename infrastructure/{docker-nextcloud => nextcloud}/image/Dockerfile (87%) rename infrastructure/{docker-nextcloud => nextcloud}/image/resources/entrypoint.sh (100%) rename infrastructure/{docker-nextcloud => nextcloud}/image/resources/install-debug.sh (100%) rename infrastructure/{docker-nextcloud => nextcloud}/image/resources/install.sh (100%) rename infrastructure/{docker-nextcloud => nextcloud}/image/resources/memory-limit.ini (100%) rename infrastructure/{docker-nextcloud => nextcloud}/image/resources/upload-max-limit.ini (100%) rename infrastructure/{docker-nextcloud => nextcloud}/test/Dockerfile (100%) rename infrastructure/{docker-nextcloud => nextcloud}/test/serverspec.edn (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f099ef9..4f5b182 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,11 +6,18 @@ stages: - image #- integrationtest -services: - - docker:19.03.12-dind +.img: &img + image: "domaindrivenarchitecture/ddadevops-dind:4.7.4" + services: + - docker:dind + before_script: + - export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW + - export IMAGE_DOCKERHUB_USER=$DOCKERHUB_USER + - export IMAGE_DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD + - export IMAGE_TAG=$CI_COMMIT_TAG .cljs-job: &cljs - image: domaindrivenarchitecture/shadow-cljs + image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.7.4" cache: key: ${CI_COMMIT_REF_SLUG} paths: @@ -18,38 +25,44 @@ services: - .shadow-cljs/ - .m2 before_script: - - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc - - npm install + - export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW + - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc + - npm install -.clj-uploadjob: &clj - image: domaindrivenarchitecture/lein +.clj-job: &clj + image: "domaindrivenarchitecture/ddadevops-clj-cljs:4.7.4" cache: key: ${CI_COMMIT_REF_SLUG} paths: - .m2 before_script: - - mkdir -p /root/.lein - - echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_TOKEN_DOMAINDRIVENARCHITECTURE}\" }}}}" > ~/.lein/profiles.clj + - export RELEASE_ARTIFACT_TOKEN=$MEISSA_REPO_BUERO_RW + - mkdir -p /root/.lein + - echo "{:auth {:repository-auth {#\"clojars\" {:username \"${CLOJARS_USER}\" :password \"${CLOJARS_TOKEN_DOMAINDRIVENARCHITECTURE}\" }}}}" > ~/.lein/profiles.clj + +.tag_only: &tag_only + rules: + - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' + when: never + - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+$/' + +test-clj: + <<: *clj + stage: build_and_test + script: + - pyb test_clj test-cljs: <<: *cljs stage: build_and_test script: - - shadow-cljs compile test - - node target/node-tests.js - -test-clj: - <<: *clj - stage: build_and_test - script: - - lein test + - pyb test_cljs test-schema: <<: *clj stage: build_and_test script: - - lein uberjar - - java -jar target/uberjar/c4k-nextcloud-standalone.jar src/test/resources/nextcloud-test/valid-config.yaml src/test/resources/nextcloud-test/valid-auth.yaml | kubeconform --kubernetes-version 1.19.0 --strict --skip "Certificate,CronJob" - + - pyb test_schema artifacts: paths: - target/uberjar @@ -58,8 +71,7 @@ report-frontend: <<: *cljs stage: package script: - - mkdir -p target/frontend-build - - shadow-cljs run shadow.cljs.build-report frontend target/frontend-build/build-report.html + - pyb report_frontend artifacts: paths: - target/frontend-build/build-report.html @@ -68,11 +80,7 @@ package-frontend: <<: *cljs stage: package script: - - mkdir -p target/frontend-build - - shadow-cljs release frontend - - cp public/js/main.js target/frontend-build/c4k-nextcloud.js - - sha256sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha256 - - sha512sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha512 + - pyb package_frontend artifacts: paths: - target/frontend-build @@ -81,72 +89,55 @@ package-uberjar: <<: *clj stage: package script: - - sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256 - - sha512sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha512 + - pyb package_uberjar artifacts: paths: - target/uberjar -upload-clj-release: +release-to-clojars: <<: *clj + <<: *tag_only stage: upload - rules: - - if: '$CI_COMMIT_TAG != null' script: - - lein deploy + - pyb upload_clj -release: - image: registry.gitlab.com/gitlab-org/release-cli:latest +release-to-forgejo: + <<: *clj + <<: *tag_only stage: upload - rules: - - if: '$CI_COMMIT_TAG != null' - artifacts: - paths: - - target/uberjar - - target/frontend-build script: - - apk --no-cache add curl - - | - release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ - --assets-link "{\"name\":\"c4k-nextcloud-standalone.jar\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar\"}" \ - --assets-link "{\"name\":\"c4k-nextcloud-standalone.jar.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar.sha256\"}" \ - --assets-link "{\"name\":\"c4k-nextcloud-standalone.jar.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/uberjar/c4k-nextcloud-standalone.jar.sha512\"}" \ - --assets-link "{\"name\":\"c4k-nextcloud.js\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js\"}" \ - --assets-link "{\"name\":\"c4k-nextcloud.js.sha256\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js.sha256\"}" \ - --assets-link "{\"name\":\"c4k-nextcloud.js.sha512\",\"url\":\"https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud/-/jobs/${CI_JOB_ID}/artifacts/file/target/frontend-build/c4k-nextcloud.js.sha512\"}" \ + - pyb publish_artifacts -nextcloud-image-test-publish: - image: domaindrivenarchitecture/devops-build:latest +backup-image-publish: + <<: *img + <<: *tag_only stage: image - rules: - - if: '$CI_COMMIT_TAG != null' script: - - cd infrastructure/docker-nextcloud && pyb image test publish + - cd infrastructure/backup && pyb image publish -backup-image-test-publish: - image: domaindrivenarchitecture/devops-build:latest +nextcloud-image-publish: + <<: *img + <<: *tag_only stage: image - rules: - - if: '$CI_COMMIT_TAG != null' script: - - cd infrastructure/docker-backup && pyb image test publish + - cd infrastructure/nextcloud && pyb image publish -.nextcloud-integrationtest: - stage: integrationtest - image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/3.7.1-kube-1.20.11-alpine-3.14 - services: - - name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v1.22.2-k3s2 - alias: k3s - script: - - apk add curl sudo bash - - apk add wget curl bash sudo openjdk8 - - wget -P /etc/apk/keys/ https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub - - apk add --no-cache --repository=https://apkproxy.herokuapp.com/sgerrand/alpine-pkg-leiningen leiningen - - - mkdir -p ${HOME}/.kube/ - - curl -f k3s:8081 > ${HOME}/.kube/config - - kubectl version - - kubectl cluster-info - - echo "---------- Integration test -------------" - - pwd - - cd ./src/test/resources/local-integration-test/ && ./setup-local-s3-on-k3d.sh +#.nextcloud-integrationtest: +# stage: integrationtest +# image: registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/3.7.1-kube-1.20.11-alpine-3.14 +# services: +# - name: registry.gitlab.com/gitlab-org/cluster-integration/test-utils/k3s-gitlab-ci/releases/v1.22.2-k3s2 +# alias: k3s +# script: +# - apk add curl sudo bash +# - apk add wget curl bash sudo openjdk8 +# - wget -P /etc/apk/keys/ https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub +# - apk add --no-cache --repository=https://apkproxy.herokuapp.com/sgerrand/alpine-pkg-leiningen leiningen +# +# - mkdir -p ${HOME}/.kube/ +# - curl -f k3s:8081 > ${HOME}/.kube/config +# - kubectl version +# - kubectl cluster-info +# - echo "---------- Integration test -------------" +# - pwd +# - cd ./src/test/resources/local-integration-test/ && ./setup-local-s3-on-k3d.sh \ No newline at end of file diff --git a/build.py b/build.py new file mode 100644 index 0000000..96392d4 --- /dev/null +++ b/build.py @@ -0,0 +1,179 @@ +from os import environ +from subprocess import run +from pybuilder.core import init, task +from ddadevops import * + +default_task = "dev" +name = 'c4k-nextcloud' +MODULE = 'not-used' +PROJECT_ROOT_PATH = '.' + +@init +def initialize(project): + project.build_depends_on("ddadevops>=4.7.0") + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": [], + "mixin_types": ["RELEASE"], + "release_primary_build_file": "project.clj", + "release_secondary_build_files": [ + "package.json", + "infrastructure/backup/build.py", + "infrastructure/nextcloud/build.py", + ], + "release_artifact_server_url": "https://repo.prod.meissa.de", + "release_organisation": "meissa", + "release_repository_name": name, + "release_artifacts": [ + "target/uberjar/c4k-nextcloud-standalone.jar", + "target/frontend-build/c4k-nextcloud.js", + ], + } + + build = ReleaseMixin(project, input) + build.initialize_build_dir() + + +@task +def test_clj(project): + run("lein test", shell=True, check=True) + + +@task +def test_cljs(project): + run("shadow-cljs compile test", shell=True, check=True) + run("node target/node-tests.js", shell=True, check=True) + + +@task +def test_schema(project): + run("lein uberjar", shell=True, check=True) + run( + "java -jar target/uberjar/c4k-nextcloud-standalone.jar " + + "src/test/resources/nextcloud-test/valid-config.yaml " + + "src/test/resources/nextcloud-test/valid-auth.yaml | " + + "kubeconform --kubernetes-version 1.23.0 --strict --skip Certificate -", + shell=True, + check=True, + ) + + +@task +def report_frontend(project): + run("mkdir -p target/frontend-build", shell=True, check=True) + run( + "shadow-cljs run shadow.cljs.build-report frontend target/frontend-build/build-report.html", + shell=True, + check=True, + ) + + +@task +def package_frontend(project): + run("mkdir -p target/frontend-build", shell=True, check=True) + run("shadow-cljs release frontend", shell=True, check=True) + run( + "cp public/js/main.js target/frontend-build/c4k-nextcloud.js", + shell=True, + check=True, + ) + run( + "sha256sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha256", + shell=True, + check=True, + ) + run( + "sha512sum target/frontend-build/c4k-nextcloud.js > target/frontend-build/c4k-nextcloud.js.sha512", + shell=True, + check=True, + ) + + +@task +def package_uberjar(project): + run( + "sha256sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha256", + shell=True, + check=True, + ) + run( + "sha512sum target/uberjar/c4k-nextcloud-standalone.jar > target/uberjar/c4k-nextcloud-standalone.jar.sha512", + shell=True, + check=True, + ) + + +@task +def upload_clj(project): + run("lein deploy", shell=True, check=True) + + +@task +def lint(project): + #run( + # "lein eastwood", + # shell=True, + # check=True, + #) + run( + "lein ancient check", + shell=True, + check=True, + ) + + +@task +def patch(project): + linttest(project, "PATCH") + release(project) + + +@task +def minor(project): + linttest(project, "MINOR") + release(project) + + +@task +def major(project): + linttest(project, "MAJOR") + release(project) + + +@task +def dev(project): + linttest(project, "NONE") + + +@task +def prepare(project): + build = get_devops_build(project) + build.prepare_release() + + +@task +def tag(project): + build = get_devops_build(project) + build.tag_bump_and_push_release() + +@task +def publish_artifacts(project): + build = get_devops_build(project) + build.publish_artifacts() + +def release(project): + prepare(project) + tag(project) + + +def linttest(project, release_type): + build = get_devops_build(project) + build.update_release_type(release_type) + test_clj(project) + test_cljs(project) + test_schema(project) + lint(project) diff --git a/infrastructure/backup/build.py b/infrastructure/backup/build.py new file mode 100644 index 0000000..dfc1ea4 --- /dev/null +++ b/infrastructure/backup/build.py @@ -0,0 +1,54 @@ +from os import environ +from datetime import datetime +from pybuilder.core import task, init +from ddadevops import * + +name = "c4k-nextcloud" +MODULE = "backup" +PROJECT_ROOT_PATH = "../.." +version = "7.0.1-SNAPSHOT" + + +@init +def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": ["IMAGE"], + "mixin_types": [], + "image_naming": "NAME_AND_MODULE", + "image_tag": f"{image_tag}", + } + + project.build_depends_on("ddadevops>=4.7.0") + + build = DevopsImageBuild(project, input) + build.initialize_build_dir() + + +@task +def image(project): + build = get_devops_build(project) + build.image() + +@task +def drun(project): + build = get_devops_build(project) + build.drun() + +@task +def test(project): + build = get_devops_build(project) + build.test() + +@task +def publish(project): + build = get_devops_build(project) + build.dockerhub_login() + build.dockerhub_publish() diff --git a/infrastructure/docker-backup/image/Dockerfile b/infrastructure/backup/image/Dockerfile similarity index 100% rename from infrastructure/docker-backup/image/Dockerfile rename to infrastructure/backup/image/Dockerfile diff --git a/infrastructure/docker-backup/image/resources/backup.sh b/infrastructure/backup/image/resources/backup.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/backup.sh rename to infrastructure/backup/image/resources/backup.sh diff --git a/infrastructure/docker-backup/image/resources/end-maintenance.sh b/infrastructure/backup/image/resources/end-maintenance.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/end-maintenance.sh rename to infrastructure/backup/image/resources/end-maintenance.sh diff --git a/infrastructure/docker-backup/image/resources/entrypoint-start-and-wait.sh b/infrastructure/backup/image/resources/entrypoint-start-and-wait.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/entrypoint-start-and-wait.sh rename to infrastructure/backup/image/resources/entrypoint-start-and-wait.sh diff --git a/infrastructure/docker-backup/image/resources/entrypoint.sh b/infrastructure/backup/image/resources/entrypoint.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/entrypoint.sh rename to infrastructure/backup/image/resources/entrypoint.sh diff --git a/infrastructure/docker-backup/image/resources/init.sh b/infrastructure/backup/image/resources/init.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/init.sh rename to infrastructure/backup/image/resources/init.sh diff --git a/infrastructure/docker-backup/image/resources/install.sh b/infrastructure/backup/image/resources/install.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/install.sh rename to infrastructure/backup/image/resources/install.sh diff --git a/infrastructure/docker-backup/image/resources/list-snapshots.sh b/infrastructure/backup/image/resources/list-snapshots.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/list-snapshots.sh rename to infrastructure/backup/image/resources/list-snapshots.sh diff --git a/infrastructure/docker-backup/image/resources/restore.sh b/infrastructure/backup/image/resources/restore.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/restore.sh rename to infrastructure/backup/image/resources/restore.sh diff --git a/infrastructure/docker-backup/image/resources/start-maintenance.sh b/infrastructure/backup/image/resources/start-maintenance.sh similarity index 100% rename from infrastructure/docker-backup/image/resources/start-maintenance.sh rename to infrastructure/backup/image/resources/start-maintenance.sh diff --git a/infrastructure/docker-backup/test/Dockerfile b/infrastructure/backup/test/Dockerfile similarity index 100% rename from infrastructure/docker-backup/test/Dockerfile rename to infrastructure/backup/test/Dockerfile diff --git a/infrastructure/docker-backup/test/serverspec.edn b/infrastructure/backup/test/serverspec.edn similarity index 100% rename from infrastructure/docker-backup/test/serverspec.edn rename to infrastructure/backup/test/serverspec.edn diff --git a/infrastructure/docker-backup/build.py b/infrastructure/docker-backup/build.py deleted file mode 100644 index efcc1fd..0000000 --- a/infrastructure/docker-backup/build.py +++ /dev/null @@ -1,52 +0,0 @@ -from os import environ -from pybuilder.core import task, init -from ddadevops import * -import logging - -name = 'c4k-cloud-backup' -MODULE = 'docker' -PROJECT_ROOT_PATH = '../..' - - -class MyBuild(DevopsDockerBuild): - pass - -@init -def initialize(project): - project.build_depends_on('ddadevops>=0.12.4') - stage = 'notused' - dockerhub_user = environ.get('DOCKERHUB_USER') - if not dockerhub_user: - dockerhub_user = gopass_field_from_path('meissa/web/docker.com', 'login') - dockerhub_password = environ.get('DOCKERHUB_PASSWORD') - if not dockerhub_password: - dockerhub_password = gopass_password_from_path('meissa/web/docker.com') - tag = environ.get('CI_COMMIT_TAG') - if not tag: - tag = get_tag_from_latest_commit() - config = create_devops_docker_build_config( - stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password, docker_publish_tag=tag) - build = MyBuild(project, config) - build.initialize_build_dir() - - -@task -def image(project): - build = get_devops_build(project) - build.image() - -@task -def drun(project): - build = get_devops_build(project) - build.drun() - -@task -def test(project): - build = get_devops_build(project) - build.test() - -@task -def publish(project): - build = get_devops_build(project) - build.dockerhub_login() - build.dockerhub_publish() diff --git a/infrastructure/docker-nextcloud/build.py b/infrastructure/docker-nextcloud/build.py deleted file mode 100644 index fdc14af..0000000 --- a/infrastructure/docker-nextcloud/build.py +++ /dev/null @@ -1,52 +0,0 @@ -from os import environ -from pybuilder.core import task, init -from ddadevops import * -import logging - -name = 'c4k-cloud' -MODULE = 'docker' -PROJECT_ROOT_PATH = '../..' - - -class MyBuild(DevopsDockerBuild): - pass - -@init -def initialize(project): - project.build_depends_on('ddadevops>=0.12.7') - stage = 'notused' - dockerhub_user = environ.get('DOCKERHUB_USER') - if not dockerhub_user: - dockerhub_user = gopass_field_from_path('meissa/web/docker.com', 'login') - dockerhub_password = environ.get('DOCKERHUB_PASSWORD') - if not dockerhub_password: - dockerhub_password = gopass_password_from_path('meissa/web/docker.com') - tag = environ.get('CI_COMMIT_TAG') - if not tag: - tag = get_tag_from_latest_commit() - config = create_devops_docker_build_config( - stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password, docker_publish_tag=tag) - build = MyBuild(project, config) - build.initialize_build_dir() - - -@task -def image(project): - build = get_devops_build(project) - build.image() - -@task -def drun(project): - build = get_devops_build(project) - build.drun() - -@task -def test(project): - build = get_devops_build(project) - build.test() - -@task -def publish(project): - build = get_devops_build(project) - build.dockerhub_login() - build.dockerhub_publish() diff --git a/infrastructure/nextcloud/build.py b/infrastructure/nextcloud/build.py new file mode 100644 index 0000000..108e6ff --- /dev/null +++ b/infrastructure/nextcloud/build.py @@ -0,0 +1,53 @@ +from os import environ +from datetime import datetime +from pybuilder.core import task, init +from ddadevops import * + +name = 'c4k-cloud' +MODULE = 'nextcloud' +PROJECT_ROOT_PATH = '../..' +version = "7.0.1-SNAPSHOT" + +@init +def initialize(project): + image_tag = version + if "dev" in image_tag: + image_tag += datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + + input = { + "name": name, + "module": MODULE, + "stage": "notused", + "project_root_path": PROJECT_ROOT_PATH, + "build_types": ["IMAGE"], + "mixin_types": [], + "image_naming": "NAME_AND_MODULE", + "image_tag": f"{image_tag}", + } + + project.build_depends_on("ddadevops>=4.7.0") + + build = DevopsImageBuild(project, input) + build.initialize_build_dir() + + +@task +def image(project): + build = get_devops_build(project) + build.image() + +@task +def drun(project): + build = get_devops_build(project) + build.drun() + +@task +def test(project): + build = get_devops_build(project) + build.test() + +@task +def publish(project): + build = get_devops_build(project) + build.dockerhub_login() + build.dockerhub_publish() diff --git a/infrastructure/docker-nextcloud/image/Dockerfile b/infrastructure/nextcloud/image/Dockerfile similarity index 87% rename from infrastructure/docker-nextcloud/image/Dockerfile rename to infrastructure/nextcloud/image/Dockerfile index e65e42b..a94a71e 100644 --- a/infrastructure/docker-nextcloud/image/Dockerfile +++ b/infrastructure/nextcloud/image/Dockerfile @@ -1,4 +1,4 @@ -FROM nextcloud:25 +FROM nextcloud:27 # Prepare Entrypoint Script ADD resources /tmp diff --git a/infrastructure/docker-nextcloud/image/resources/entrypoint.sh b/infrastructure/nextcloud/image/resources/entrypoint.sh similarity index 100% rename from infrastructure/docker-nextcloud/image/resources/entrypoint.sh rename to infrastructure/nextcloud/image/resources/entrypoint.sh diff --git a/infrastructure/docker-nextcloud/image/resources/install-debug.sh b/infrastructure/nextcloud/image/resources/install-debug.sh similarity index 100% rename from infrastructure/docker-nextcloud/image/resources/install-debug.sh rename to infrastructure/nextcloud/image/resources/install-debug.sh diff --git a/infrastructure/docker-nextcloud/image/resources/install.sh b/infrastructure/nextcloud/image/resources/install.sh similarity index 100% rename from infrastructure/docker-nextcloud/image/resources/install.sh rename to infrastructure/nextcloud/image/resources/install.sh diff --git a/infrastructure/docker-nextcloud/image/resources/memory-limit.ini b/infrastructure/nextcloud/image/resources/memory-limit.ini similarity index 100% rename from infrastructure/docker-nextcloud/image/resources/memory-limit.ini rename to infrastructure/nextcloud/image/resources/memory-limit.ini diff --git a/infrastructure/docker-nextcloud/image/resources/upload-max-limit.ini b/infrastructure/nextcloud/image/resources/upload-max-limit.ini similarity index 100% rename from infrastructure/docker-nextcloud/image/resources/upload-max-limit.ini rename to infrastructure/nextcloud/image/resources/upload-max-limit.ini diff --git a/infrastructure/docker-nextcloud/test/Dockerfile b/infrastructure/nextcloud/test/Dockerfile similarity index 100% rename from infrastructure/docker-nextcloud/test/Dockerfile rename to infrastructure/nextcloud/test/Dockerfile diff --git a/infrastructure/docker-nextcloud/test/serverspec.edn b/infrastructure/nextcloud/test/serverspec.edn similarity index 100% rename from infrastructure/docker-nextcloud/test/serverspec.edn rename to infrastructure/nextcloud/test/serverspec.edn