| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| variables: |
| IMAGE_NAME: $REGISTRY_HOST/$CI_PROJECT_PATH |
| HARBOR_IMAGE_NAME: $HARBOR_REGISTRY_HOST/$CI_PROJECT_PATH |
| MAVEN_CLI_OPTS: -DskipTests --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true |
| GIT_REPO_ORIGIN: $GIT_REPO_ORIGIN |
| GIT_STRATEGY: clone |
| DOCKER_CLI_EXPERIMENTAL: enabled |
| BASE_IMAGE_AMD64: adoptopenjdk/openjdk8-openj9:alpine-slim |
| BASE_IMAGE_ARM32v7: arm32v7/openjdk:11-jre-slim |
| BASE_IMAGE_ARM64v8: arm64v8/openjdk:11-jre-slim |
| BASE_NGINX_AMD64: nginx |
| BASE_NGINX_ARM32v7: arm32v7/nginx |
| BASE_NGINX_ARM64v8: arm64v8/nginx |
| |
| stages: |
| - github |
| - build |
| - docker |
| |
| pull github: |
| image: maven:3-jdk-8 |
| stage: github |
| script: |
| - git remote set-url origin $GIT_REPO_ORIGIN/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME.git |
| - git remote add github https://github.com/apache/incubator-streampipes.git |
| - eval $(ssh-agent -s) |
| - ssh-add <(echo "$SSH") |
| - mkdir ~/.ssh |
| - touch ~/.ssh/known_hosts |
| - ssh-keyscan -p 2222 -t rsa $GITLAB_HOST > ~/.ssh/known_hosts |
| - git config --global user.email '$USER_EMAIL' |
| - git config --global user.name '$USER_NAME' |
| - git checkout dev |
| - git pull github dev --allow-unrelated-histories |
| - git push origin --all |
| |
| build: |
| image: maven:3-jdk-8 |
| stage: build |
| script: |
| - echo "$GPG_PRIVATE_KEY" | gpg --batch --import --passphrase "$GPG_PASSPHRASE" |
| - echo "$MAVEN_CREDENTIALS" > /root/.m2/settings.xml |
| - mvn clean package javadoc:aggregate |
| # - mvn clean package javadoc:aggregate |
| - export MVN_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v '\[') |
| - "echo $MVN_VERSION >> ./target/mvn_version" |
| artifacts: |
| paths: |
| - ./streampipes-backend/target/streampipes-backend.jar |
| - ./streampipes-connect-container-master/target/streampipes-connect-container-master.jar |
| - ./target/site/apidocs/** |
| - ./target/mvn_version |
| expire_in: 1 week |
| except: |
| - /release-.*$/ |
| |
| build-ui: |
| image: node:8-alpine |
| stage: build |
| script: |
| - cd ui |
| - export NODE_PATH=/cache/node_modules |
| - export NODE_OPTIONS=--max_old_space_size=4096 |
| - npm install --unsafe-perm |
| - npm run build |
| artifacts: |
| paths: |
| - ui/dist/assets/css/ |
| - ui/dist/assets/img/ |
| - ui/dist/assets/lib/ |
| - ui/dist/assets/templates/ |
| - ui/dist/assets/fonts/ |
| - ui/dist/index.html |
| - ui/dist/main.bundle.js |
| - ui/dist/main.bundle.js.gz |
| - ui/dist/polyfills.bundle.js |
| - ui/dist/polyfills.bundle.js.gz |
| - ui/dist/style.bundle.css |
| - ui/dist/style.bundle.css.gz |
| - ui/dist/style.bundle.js |
| - ui/dist/style.bundle.js.gz |
| - ui/dist/style.css |
| - ui/dist/style.css.gz |
| expire_in: 1 hour |
| only: |
| - dev |
| |
| docker-ui: |
| image: docker:19.03.5 |
| stage: docker |
| dependencies: |
| - build |
| - build-ui |
| script: |
| - export MVN_VERSION=$(cat ./target/mvn_version) |
| - apk update |
| - apk add curl |
| - apk add unzip |
| - apk add bash |
| # - 'curl -k -f -L -H "PRIVATE-TOKEN: ${API_KEY}" -o javadoc.zip "https://ipe-wim-gitlab.fzi.de/streampipes/ce/-/jobs/artifacts/dev/download?job=build"' |
| # - unzip javadoc.zip |
| # - mkdir javadoc && mv target/site/apidocs/* ./javadoc |
| - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $REGISTRY_HOST |
| # Build AMD64 |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_NGINX_AMD64 |
| -t $IMAGE_NAME/ui:amd64 -t $IMAGE_NAME/ui:amd64-$MVN_VERSION |
| -f ./ui/Dockerfile ./ui |
| # Build ARM32v7, ARM64v8 |
| # Download qemu static and make it executable so it can be used during the docker build phase |
| - wget https://github.com/multiarch/qemu-user-static/releases/download/v4.0.0/qemu-arm-static -P ./ui |
| - wget https://github.com/multiarch/qemu-user-static/releases/download/v4.0.0/qemu-aarch64-static -P ./ui |
| - chmod 554 ./ui/qemu-arm-static |
| - chmod 554 ./ui/qemu-aarch64-static |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_NGINX_ARM32v7 --build-arg QEMU=qemu-arm-static |
| -t $IMAGE_NAME/ui:arm32v7 -t $IMAGE_NAME/ui:arm32v7-$MVN_VERSION |
| -f ./ui/arm.Dockerfile ./ui |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_NGINX_ARM64v8 --build-arg QEMU=qemu-aarch64-static |
| -t $IMAGE_NAME/ui:arm64v8 -t $IMAGE_NAME/ui:arm64v8-$MVN_VERSION |
| -f ./ui/aarch64.Dockerfile ./ui |
| # Push Docker images: AMD64, ARM32v7, ARM64v8 |
| - docker push $IMAGE_NAME/ui:amd64-$MVN_VERSION |
| - docker push $IMAGE_NAME/ui:amd64 |
| - docker push $IMAGE_NAME/ui:arm32v7-$MVN_VERSION |
| - docker push $IMAGE_NAME/ui:arm32v7 |
| - docker push $IMAGE_NAME/ui:arm64v8-$MVN_VERSION |
| - docker push $IMAGE_NAME/ui:arm64v8 |
| # Create Docker manifest |
| - docker manifest create $IMAGE_NAME/ui:$MVN_VERSION |
| $IMAGE_NAME/ui:amd64-$MVN_VERSION |
| $IMAGE_NAME/ui:arm32v7-$MVN_VERSION |
| $IMAGE_NAME/ui:arm64v8-$MVN_VERSION |
| - docker manifest annotate $IMAGE_NAME/ui:$MVN_VERSION $IMAGE_NAME/ui:arm32v7-$MVN_VERSION --os linux --arch arm |
| - docker manifest annotate $IMAGE_NAME/ui:$MVN_VERSION $IMAGE_NAME/ui:arm64v8-$MVN_VERSION --os linux --arch arm64 |
| - docker manifest push $IMAGE_NAME/ui:$MVN_VERSION |
| |
| docker-backend: |
| image: docker:19.03.5 |
| stage: docker |
| dependencies: |
| - build |
| script: |
| - export MVN_VERSION=$(cat ./target/mvn_version) |
| - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $REGISTRY_HOST |
| # Build AMD64 |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_IMAGE_AMD64 |
| -t $IMAGE_NAME/backend:amd64 -t $IMAGE_NAME/backend:amd64-$MVN_VERSION |
| -f ./streampipes-backend/Dockerfile ./streampipes-backend |
| # Build ARM32v7, ARM64v8 |
| # Download qemu static and make it executable so it can be used during the docker build phase |
| - wget https://github.com/multiarch/qemu-user-static/releases/download/v4.0.0/qemu-arm-static -P ./streampipes-backend |
| - wget https://github.com/multiarch/qemu-user-static/releases/download/v4.0.0/qemu-aarch64-static -P ./streampipes-backend |
| - chmod 554 ./streampipes-backend/qemu-arm-static |
| - chmod 554 ./streampipes-backend/qemu-aarch64-static |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_IMAGE_ARM32v7 --build-arg QEMU=qemu-arm-static |
| -t $IMAGE_NAME/backend:arm32v7 -t $IMAGE_NAME/backend:arm32v7-$MVN_VERSION |
| -f ./streampipes-backend/arm.Dockerfile ./streampipes-backend |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_IMAGE_ARM64v8 --build-arg QEMU=qemu-aarch64-static |
| -t $IMAGE_NAME/backend:arm64v8 -t $IMAGE_NAME/backend:arm64v8-$MVN_VERSION |
| -f ./streampipes-backend/aarch64.Dockerfile ./streampipes-backend |
| # Push Docker images: AMD64, ARM32v7, ARM64v8 |
| - docker push $IMAGE_NAME/backend:amd64-$MVN_VERSION |
| - docker push $IMAGE_NAME/backend:amd64 |
| - docker push $IMAGE_NAME/backend:arm32v7-$MVN_VERSION |
| - docker push $IMAGE_NAME/backend:arm32v7 |
| - docker push $IMAGE_NAME/backend:arm64v8-$MVN_VERSION |
| - docker push $IMAGE_NAME/backend:arm64v8 |
| # Create Docker manifest |
| - docker manifest create $IMAGE_NAME/backend:$MVN_VERSION |
| $IMAGE_NAME/backend:amd64-$MVN_VERSION |
| $IMAGE_NAME/backend:arm32v7-$MVN_VERSION |
| $IMAGE_NAME/backend:arm64v8-$MVN_VERSION |
| - docker manifest annotate $IMAGE_NAME/backend:$MVN_VERSION $IMAGE_NAME/backend:arm32v7-$MVN_VERSION --os linux --arch arm |
| - docker manifest annotate $IMAGE_NAME/backend:$MVN_VERSION $IMAGE_NAME/backend:arm64v8-$MVN_VERSION --os linux --arch arm64 |
| - docker manifest push $IMAGE_NAME/backend:$MVN_VERSION |
| only: |
| - dev |
| |
| docker-connect-container: |
| image: docker:19.03.5 |
| stage: docker |
| dependencies: |
| - build |
| script: |
| - export MVN_VERSION=$(cat ./target/mvn_version) |
| - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $REGISTRY_HOST |
| # Build AMD64 |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_IMAGE_AMD64 |
| -t $IMAGE_NAME/streampipes-connect-container:amd64 -t $IMAGE_NAME/streampipes-connect-container:amd64-$MVN_VERSION |
| -f ./streampipes-connect-container-master/Dockerfile ./streampipes-connect-container-master |
| # Build ARM32v7,ARM64v8 |
| # Download qemu static and make it executable so it can be used during the docker build phase |
| - wget https://github.com/multiarch/qemu-user-static/releases/download/v4.0.0/qemu-arm-static -P ./streampipes-connect-container-master |
| - wget https://github.com/multiarch/qemu-user-static/releases/download/v4.0.0/qemu-aarch64-static -P ./streampipes-connect-container-master |
| - chmod 554 ./streampipes-connect-container-master/qemu-arm-static |
| - chmod 554 ./streampipes-connect-container-master/qemu-aarch64-static |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_IMAGE_ARM32v7 --build-arg QEMU=qemu-arm-static |
| -t $IMAGE_NAME/streampipes-connect-container:arm32v7 -t $IMAGE_NAME/streampipes-connect-container:arm32v7-$MVN_VERSION |
| -f ./streampipes-connect-container-master/arm.Dockerfile ./streampipes-connect-container-master |
| - docker build --pull --build-arg BASE_IMAGE=$BASE_IMAGE_ARM64v8 --build-arg QEMU=qemu-aarch64-static |
| -t $IMAGE_NAME/streampipes-connect-container:arm64v8 -t $IMAGE_NAME/streampipes-connect-container:arm64v8-$MVN_VERSION |
| -f ./streampipes-connect-container-master/aarch64.Dockerfile ./streampipes-connect-container-master |
| # Push Docker images: AMD64, ARM32v7, ARM64v8 |
| - docker push $IMAGE_NAME/streampipes-connect-container:amd64-$MVN_VERSION |
| - docker push $IMAGE_NAME/streampipes-connect-container:amd64 |
| - docker push $IMAGE_NAME/streampipes-connect-container:arm32v7-$MVN_VERSION |
| - docker push $IMAGE_NAME/streampipes-connect-container:arm32v7 |
| - docker push $IMAGE_NAME/streampipes-connect-container:arm64v8-$MVN_VERSION |
| - docker push $IMAGE_NAME/streampipes-connect-container:arm64v8 |
| # Create Docker manifest |
| - docker manifest create $IMAGE_NAME/streampipes-connect-container:$MVN_VERSION |
| $IMAGE_NAME/streampipes-connect-container:amd64-$MVN_VERSION |
| $IMAGE_NAME/streampipes-connect-container:arm32v7-$MVN_VERSION |
| $IMAGE_NAME/streampipes-connect-container:arm64v8-$MVN_VERSION |
| - docker manifest annotate $IMAGE_NAME/streampipes-connect-container:$MVN_VERSION $IMAGE_NAME/streampipes-connect-container:arm32v7-$MVN_VERSION --os linux --arch arm |
| - docker manifest annotate $IMAGE_NAME/streampipes-connect-container:$MVN_VERSION $IMAGE_NAME/streampipes-connect-container:arm64v8-$MVN_VERSION --os linux --arch arm64 |
| - docker manifest push $IMAGE_NAME/streampipes-connect-container:$MVN_VERSION |
| only: |
| - dev |
| |