diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 083450ea6..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,109 +0,0 @@ -version: 2.1 - -# Copyright (C) 2019-2020 LEIDOS. -# -# Licensed 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. -# - -# Configuration file for Circle CI -# CI will report failure if any executed command returns and error status -# Operations performed are as follows -# Build source code -# Run unit tests for C++ -# Run static code analyzer for SourceCloud -# Upload test results -# Every run command should start with source ${INIT_ENV} to ensure all default dependencies are available -jobs: - arm_build_push : - machine: - # see https://circleci.com/docs/using-arm/ for versions - image: ubuntu-2004:current - resource_class: arm.medium - steps: - - checkout - - run: - name: Docker Build - # Run MYSQL image and build v2xhub docker image - command: | - docker build -t v2xhubarm:ci-build . - docker build -f docker/Dockerfile-php -t php_arm:ci-build . - cd ./tools/port-drayage-webservice/ - docker build -f Dockerfile-arm -t port-drayage-webservice_arm:ci-build . - if [ -n "$CIRCLE_PR_NUMBER" ]; then - circleci-agent step halt - fi - - run: - name: Docker Push - # Push v2xhub docker image to usdotfhwaops dockerhub - command: | - if [ "$CIRCLE_BRANCH" = "develop" ]; then - DOCKER_TAG="latest" - else - DOCKER_TAG=${CIRCLE_BRANCH/\//-} - fi - docker tag v2xhubarm:ci-build usdotfhwaops/v2xhubarm:${DOCKER_TAG} - docker tag php_arm:ci-build usdotfhwaops/php_arm:${DOCKER_TAG} - docker tag port-drayage-webservice_arm:ci-build usdotfhwaops/port-drayage-webservice_arm:${DOCKER_TAG} - echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin - docker push usdotfhwaops/v2xhubarm:${DOCKER_TAG} - docker push usdotfhwaops/php_arm:${DOCKER_TAG} - docker push usdotfhwaops/port-drayage-webservice_arm:${DOCKER_TAG} - automated_release : - machine: - image: ubuntu-2004:202201-02 - steps: - - run: - name: Docker Pull Release - # Pull all built images associated with github tag - command: | - docker pull usdotfhwaops/php:master - docker pull usdotfhwaops/port-drayage-webservice:master - docker pull usdotfhwaops/v2xhubamd:master - docker pull usdotfhwaops/php_arm:master - docker pull usdotfhwaops/port-drayage-webservice_arm:master - docker pull usdotfhwaops/v2xhubarm:master - - run: - name: Docker Tag Release - # Tag all pulled images with github tag name - command: | - docker tag usdotfhwaops/php:master usdotfhwaops/php:${CIRCLE_TAG} - docker tag usdotfhwaops/port-drayage-webservice:master usdotfhwaops/port-drayage-webservice:${CIRCLE_TAG} - docker tag usdotfhwaops/v2xhubamd:master usdotfhwaops/v2xhubamd:${CIRCLE_TAG} - docker tag usdotfhwaops/php_arm:master usdotfhwaops/php_arm:${CIRCLE_TAG} - docker tag usdotfhwaops/port-drayage-webservice_arm:master usdotfhwaops/port-drayage-webservice_arm:${CIRCLE_TAG} - docker tag usdotfhwaops/v2xhubarm:master usdotfhwaops/v2xhubarm:${CIRCLE_TAG} - - run: - name: Docker Push Release Tag - # Push all tagged images - command: | - echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin - docker push usdotfhwaops/php:${CIRCLE_TAG} - docker push usdotfhwaops/port-drayage-webservice:${CIRCLE_TAG} - docker push usdotfhwaops/v2xhubamd:${CIRCLE_TAG} - docker push usdotfhwaops/php_arm:${CIRCLE_TAG} - docker push usdotfhwaops/port-drayage-webservice_arm:${CIRCLE_TAG} - docker push usdotfhwaops/v2xhubarm:${CIRCLE_TAG} -workflows: - version: 2 - build: - jobs: - - arm_build_push: - filters: - tags: - only: /^[\.0-9]*$/ - - automated_release: - filters: - tags: - only: /^[\.0-9]*$/ - branches: - ignore: /.*/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index eed361c5b..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,106 +0,0 @@ -name: Build Workflows - -on: - pull_request: - push: - -# TODO push to dockerhub with correct tags -jobs: - v2xhub-docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: usdotfhwaops/v2xhubamd - tags: | - type=schedule - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - - name: Build and push - uses: docker/build-push-action@v4 - with: - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - php-docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: usdotfhwaops/php - tags: | - type=schedule - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - - name: Build and push - uses: docker/build-push-action@v4 - with: - file: docker/Dockerfile-php - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - port-drayage-docker: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: usdotfhwaops/port-drayage-webservice - tags: | - type=schedule - type=ref,event=branch - type=ref,event=tag - type=ref,event=pr - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - - name: Build and push - uses: docker/build-push-action@v4 - with: - push: true - context: tools/port-drayage-webservice - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/build_php_docker_image.yml b/.github/workflows/build_php_docker_image.yml new file mode 100644 index 000000000..bb9ee7cc1 --- /dev/null +++ b/.github/workflows/build_php_docker_image.yml @@ -0,0 +1,48 @@ +name: Build PHP V2X-Hub Web UI +on: + push: + branches: + - develop + - master + - 'release/**' + # Build all tags not containing a / (https://stackoverflow.com/questions/61891328/trigger-github-action-only-on-new-tags ) + tags: + - '*' +jobs: + v2xhub-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: usdotfhwaops/php + tags: | + type=schedule + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + platforms: linux/amd64,linux/arm64 + file: ./docker/Dockerfile-php + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_ARCHITECTURE=${{ matrix.architecture }} + UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} diff --git a/.github/workflows/build_port_drayage_docker_image.yml b/.github/workflows/build_port_drayage_docker_image.yml new file mode 100644 index 000000000..dd9115995 --- /dev/null +++ b/.github/workflows/build_port_drayage_docker_image.yml @@ -0,0 +1,48 @@ +name: Build Port Drayage Web Service +on: + push: + branches: + - develop + - master + - 'release/**' + # Build all tags not containing a / (https://stackoverflow.com/questions/61891328/trigger-github-action-only-on-new-tags ) + tags: + - '*' +jobs: + v2xhub-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: usdotfhwaops/port-drayage-webservice + tags: | + type=schedule + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + platforms: linux/amd64,linux/arm64 + context: ./tools/port-drayage-webservice/ + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_ARCHITECTURE=${{ matrix.architecture }} + UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} diff --git a/.github/workflows/build_v2xhub_docker_image.yml b/.github/workflows/build_v2xhub_docker_image.yml new file mode 100644 index 000000000..c8ec318d9 --- /dev/null +++ b/.github/workflows/build_v2xhub_docker_image.yml @@ -0,0 +1,47 @@ +name: Build V2X-Hub Docker Image +on: + push: + branches: + - develop + - master + - 'release/**' + # Build all tags not containing a / (https://stackoverflow.com/questions/61891328/trigger-github-action-only-on-new-tags ) + tags: + - '*' +jobs: + v2xhub-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: usdotfhwaops/v2xhub + tags: | + type=schedule + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_ARCHITECTURE=${{ matrix.architecture }} + UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 000000000..17d8f1dc6 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,51 @@ +name: Pull Request Workflow + +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + docker-image-builds: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: usdotfhwaops/php + tags: | + type=schedule + type=ref,event=branch + type=ref,event=tag + type=ref,event=pr + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + - name: V2X-Hub Docker build + uses: docker/build-push-action@v5 + with: + file: Dockerfile + platforms: linux/amd64,linux/arm64 + build-args: | + BUILD_ARCHITECTURE=${{ matrix.architecture }} + UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} + - name: PHP Docker build + uses: docker/build-push-action@v5 + with: + file: docker/Dockerfile-php + platforms: linux/amd64,linux/arm64 + build-args: | + BUILD_ARCHITECTURE=${{ matrix.architecture }} + UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} + - name: Port Drayage Docker build + uses: docker/build-push-action@v5 + with: + context: tools/port-drayage-webservice + platforms: linux/amd64,linux/arm64 + build-args: | + BUILD_ARCHITECTURE=${{ matrix.architecture }} + UBUNTU_CODENAME=${{ matrix.ubuntu-codename }} diff --git a/.github/workflows/sonar-scanner.yml b/.github/workflows/sonar-scanner.yml index 6df6b7812..ded72973a 100644 --- a/.github/workflows/sonar-scanner.yml +++ b/.github/workflows/sonar-scanner.yml @@ -1,7 +1,10 @@ on: push: - # run on branches and not PRs due to secrets used branches: + - develop + - master + pull_request: + types: [opened, synchronize, reopened] name: Sonar Workflow jobs: sonarcloud: @@ -15,7 +18,7 @@ jobs: export DEBIAN_FRONTEND=noninteractive apt-get install -y curl zip git gcovr - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # Disabling shallow clone is recommended for improving relevancy of reporting fetch-depth: 0 diff --git a/configuration/amd64/docker-compose.yml b/configuration/amd64/docker-compose.yml index 0c9d5feb2..6d682d25f 100755 --- a/configuration/amd64/docker-compose.yml +++ b/configuration/amd64/docker-compose.yml @@ -20,7 +20,7 @@ services: - mysql-datavolume:/var/lib/mysql php: - image: usdotfhwaops/php:latest + image: usdotfhwaops/php:develop container_name: php network_mode: host depends_on: @@ -30,7 +30,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubamd:latest + image: usdotfhwaops/v2xhub:develop container_name: v2xhub network_mode: host restart: always @@ -46,7 +46,7 @@ services: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice:latest + image: usdotfhwaops/port-drayage-webservice:develop container_name: port_drayage_webservice network_mode: host secrets: diff --git a/configuration/arm64/docker-compose.yml b/configuration/arm64/docker-compose.yml index a32c31fab..bd25756d6 100644 --- a/configuration/arm64/docker-compose.yml +++ b/configuration/arm64/docker-compose.yml @@ -20,7 +20,7 @@ services: - mysql-datavolume:/var/lib/mysql php: - image: usdotfhwaops/php_arm:latest + image: usdotfhwaops/php:develop container_name: php network_mode: host depends_on: @@ -30,7 +30,7 @@ services: tty: true v2xhub: - image: usdotfhwaops/v2xhubarm:latest + image: usdotfhwaops/v2xhub:develop container_name: v2xhub network_mode: host restart: always @@ -44,7 +44,7 @@ services: - ./logs:/var/log/tmx - ./MAP:/var/www/plugins/MAP port_drayage_webservice: - image: usdotfhwaops/port-drayage-webservice_arm:latest + image: usdotfhwaops/port-drayage-webservice:develop container_name: port_drayage_webservice network_mode: host secrets: diff --git a/tools/port-drayage-webservice/Dockerfile b/tools/port-drayage-webservice/Dockerfile index 1f27a0549..27e8e0402 100644 --- a/tools/port-drayage-webservice/Dockerfile +++ b/tools/port-drayage-webservice/Dockerfile @@ -1,10 +1,10 @@ -FROM amd64/maven:3.8-jdk-11-slim AS maven_build +FROM maven:3.8-jdk-11-slim AS maven_build RUN mkdir /home/port-drayage-webservice COPY src/ /home/port-drayage-webservice/src/ COPY pom.xml /home/port-drayage-webservice/ WORKDIR /home/port-drayage-webservice/ RUN mvn clean install -FROM amd64/alpine:latest +FROM alpine:latest RUN mkdir /home/port-drayage-webservice/ RUN apk add openjdk11-jre --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community COPY --from=maven_build /home/port-drayage-webservice/target/port-drayage-webservice-0.0.1-SNAPSHOT.jar /home/port-drayage-webservice/ diff --git a/tools/port-drayage-webservice/Dockerfile-arm b/tools/port-drayage-webservice/Dockerfile-arm deleted file mode 100644 index e83deb874..000000000 --- a/tools/port-drayage-webservice/Dockerfile-arm +++ /dev/null @@ -1,12 +0,0 @@ -FROM arm64v8/maven:3.8-jdk-11-slim AS maven_build -RUN mkdir /home/port-drayage-webservice -COPY src/ /home/port-drayage-webservice/src/ -COPY pom.xml /home/port-drayage-webservice/ -WORKDIR /home/port-drayage-webservice/ -RUN mvn clean install -FROM arm64v8/alpine:latest -RUN mkdir /home/port-drayage-webservice/ -RUN apk add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community -COPY --from=maven_build /home/port-drayage-webservice/target/port-drayage-webservice-0.0.1-SNAPSHOT.jar /home/port-drayage-webservice/ -WORKDIR /home/port-drayage-webservice/ -ENTRYPOINT ["java","-jar","port-drayage-webservice-0.0.1-SNAPSHOT.jar"] \ No newline at end of file