Skip to content

Commit

Permalink
Merge pull request #3037 from reportportal/5.7
Browse files Browse the repository at this point in the history
Release 5.7
  • Loading branch information
AmsterGet authored Apr 12, 2022
2 parents 7739169 + f5a701c commit 757693b
Show file tree
Hide file tree
Showing 369 changed files with 10,903 additions and 5,984 deletions.
40 changes: 5 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,61 +17,31 @@ on:

env:
UI_BUILD_REACT: 'app/'
GODIRS_NOVENDOR: '`go list ./... | grep -v /vendor/`'
PACKAGE_COMMONS: 'github.com/reportportal/commons-go/v5'
BINARY_DIR: 'bin'
BUILD_INFO_LDFLAGS: >-
-ldflags "-extldflags '"-static"'
-X ${PACKAGE_COMMONS}/commons.repo=${GITHUB_REPOSITORY}
-X ${PACKAGE_COMMONS}/commons.branch=${GITHUB_SHA}
-X ${PACKAGE_COMMONS}/commons.buildDate=${BUILD_DATE}
-X ${PACKAGE_COMMONS}/commons.version=${VERSION}"

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [11, 12]

steps:
- name: Get Date
run: 'echo "BUILD_DATE=`date +%FT%T%z`" >> $GITHUB_ENV'

- uses: actions/checkout@v2

- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '10.13.0'

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.1'
node-version: ${{ matrix.node }}

- name: JS Build
env:
NODE_OPTIONS: '--max_old_space_size=4096'
NODE_OPTIONS: '--max_old_space_size=2048'

run: |
npm --prefix ${{ env.UI_BUILD_REACT }} ci
npm --prefix ${{ env.UI_BUILD_REACT }} run lint
npm --prefix ${{ env.UI_BUILD_REACT }} run test:coverage
npm --prefix ${{ env.UI_BUILD_REACT }} run build
- name: Go Linter
uses: golangci/golangci-lint-action@v2
with:
version: v1.36.0
skip-go-installation: true
args: '--deadline 10m'

- name: Go Tests
run: 'go test ${{ env.GODIRS_NOVENDOR }}'

- name: Go Build
env:
CGO_ENABLED: 0
GOOS: linux
run: 'go build ${{ env.BUILD_INFO_LDFLAGS }} -o ${{ env.BINARY_DIR }}/service-ui ./'

- name: Codecov report
uses: codecov/codecov-action@v1
83 changes: 8 additions & 75 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,12 @@ on:

env:
UI_BUILD_REACT: 'app/'
GODIRS_NOVENDOR: '`go list ./... | grep -v /vendor/`'
PACKAGE_COMMONS: 'github.com/reportportal/commons-go/v5'
RELEASE_DIR: 'release'
LINUX_ARTIFACT_NAME: 'service-ui_linux_amd64'
WINDOWS_ARTIFACT_NAME: 'service-ui_win_amd64.exe'
UI_ARTIFACT_NAME: 'ui.tar.gz'
VERSION_PLACEHOLDER: '{{.version}}'
DOCKER_TEMPLATE_FILE: 'docker/DockerfileTmpl'
DOCKER_BUILD_FILE: 'Dockerfile'
BUILD_INFO_LDFLAGS: >-
-ldflags "-extldflags '"-static"'
-X ${PACKAGE_COMMONS}/commons.repo=${GITHUB_REPOSITORY}
-X ${PACKAGE_COMMONS}/commons.branch=${GITHUB_SHA}
-X ${PACKAGE_COMMONS}/commons.buildDate=${BUILD_DATE}
-X ${PACKAGE_COMMONS}/commons.version=${VERSION}"
BUILD_INFO_FILE: 'buildInfo.json'

jobs:
build:
Expand All @@ -38,64 +29,28 @@ jobs:
- name: Setup NodeJS
uses: actions/setup-node@v2
with:
node-version: '10.13.0'

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.1'
node-version: '12'

- name: JS Build
env:
NODE_OPTIONS: '--max_old_space_size=4096'
NODE_OPTIONS: '--max_old_space_size=2048'

run: |
npm --prefix ${{ env.UI_BUILD_REACT }} ci
npm --prefix ${{ env.UI_BUILD_REACT }} run lint
npm --prefix ${{ env.UI_BUILD_REACT }} run test:coverage
npm --prefix ${{ env.UI_BUILD_REACT }} run build
- name: Generate Build info
run: |
echo '{"build": { "version": "${{ github.event.inputs.version }}", "branch": "${{ github.sha }}", "build_date": "${{ env.BUILD_DATE }}", "name": "Service UI", "repo": "${{ github.repository }}"}}' > ./${{ env.UI_BUILD_REACT }}build/${{ env.BUILD_INFO_FILE }}
- name: Create release directory
run: mkdir -v ${{ github.workspace }}/${{ env.RELEASE_DIR }}

- name: UI assets compress
run: 'cd ${{ env.UI_BUILD_REACT }}build && tar -czvf "${{ github.workspace }}/${{ env.RELEASE_DIR }}/${{ env.UI_ARTIFACT_NAME }}" ./'

- name: Go Linter
uses: golangci/golangci-lint-action@v2
with:
version: v1.36.0
skip-go-installation: true
args: '--deadline 10m'

- name: Go Tests
run: 'go test ${{ env.GODIRS_NOVENDOR }}'

- name: Go Dependencies
run: |
go mod download
go mod tidy
- name: Go Build Linux
env:
CGO_ENABLED: 0
GOOS: linux
GOARCH: amd64
VERSION: ${{ github.event.inputs.version }}
run: |
go build ${{ env.BUILD_INFO_LDFLAGS }} -o ${{ env.RELEASE_DIR }}/${{ env.LINUX_ARTIFACT_NAME }} ./
file ${{ env.RELEASE_DIR }}/${{ env.LINUX_ARTIFACT_NAME }}
- name: Go Build Windows
env:
CGO_ENABLED: 0
GOOS: windows
GOARCH: amd64
VERSION: ${{ github.event.inputs.version }}
run: |
go build ${{ env.BUILD_INFO_LDFLAGS }} -o ${{ env.RELEASE_DIR }}/${{ env.WINDOWS_ARTIFACT_NAME }} ./
file ${{ env.RELEASE_DIR }}/${{ env.WINDOWS_ARTIFACT_NAME }}
- name: Setup git credentials
uses: oleksiyrudenko/gha-git-credentials@v2
with:
Expand Down Expand Up @@ -129,28 +84,6 @@ jobs:
draft: false
prerelease: false

- name: Upload Linix Binary Asset
id: upload-linux-binary-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ env.RELEASE_DIR }}/${{ env.LINUX_ARTIFACT_NAME }}
asset_name: ${{ env.LINUX_ARTIFACT_NAME }}
asset_content_type: application/octet-stream

- name: Upload Windows Binary Asset
id: upload-windows-binary-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.createRelease.outputs.upload_url }}
asset_path: ${{ env.RELEASE_DIR }}/${{ env.WINDOWS_ARTIFACT_NAME }}
asset_name: ${{ env.WINDOWS_ARTIFACT_NAME }}
asset_content_type: application/octet-stream

- name: Upload UI Asset
id: upload-ui-asset
uses: actions/upload-release-asset@v1
Expand Down
76 changes: 0 additions & 76 deletions .golangci.yml

This file was deleted.

13 changes: 4 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
FROM alpine:3.10
FROM nginx:alpine

LABEL maintainer="Andrei Varabyeu <[email protected]>"
LABEL version=5.6.0

ENV APP_DOWNLOAD_URL https://github.com/reportportal/service-ui/releases/download/v5.6.0

ADD ${APP_DOWNLOAD_URL}/service-ui_linux_amd64 /service-ui
ADD ${APP_DOWNLOAD_URL}/ui.tar.gz /

RUN mkdir /public
RUN chmod +x /service-ui
RUN tar -zxvf ui.tar.gz -C /public && rm -f ui.tar.gz

ENV RP_STATICS_PATH=/public

RUN tar -zxvf ui.tar.gz -C /usr/share/nginx/html && rm -f ui.tar.gz
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 8080
ENTRYPOINT ["/service-ui"]
37 changes: 15 additions & 22 deletions Dockerfile-full
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
FROM golang:1.15.7 as build-backend
WORKDIR /go/src/github.com/reportportal/service-ui/

ENV GO111MODULE=on
COPY ./Makefile ./go.mod .golangci.yml ./
RUN make get-build-deps

FROM alpine:3.10.9 as generate-build-info
RUN apk add git
RUN apk add make
RUN mkdir -p /usr/src/app/build
COPY ./Makefile /usr/src/
WORKDIR /usr/src
ARG version
RUN make generate-build-info v=$version

COPY ./main.go ./
RUN make fmt
RUN make build-server v=$version

FROM node:11-alpine as build-frontend
FROM node:12-alpine as build-frontend
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY ./app/ /usr/src/app/
RUN npm ci
RUN NODE_OPTIONS=--max_old_space_size=4096 npm run build && npm run test

FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=build-backend /go/src/github.com/reportportal/service-ui/bin/service-ui /
COPY --from=build-frontend /usr/src/app/build /public
RUN export NODE_OPTIONS="--max-old-space-size=4096"
RUN npm ci && npm run build && npm run test

ENV RP_STATICS_PATH=/public
FROM nginx:alpine
COPY --from=build-frontend /usr/src/app/build /usr/share/nginx/html
COPY --from=generate-build-info /usr/src/app/build /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/nginx.conf

EXPOSE 8080
ENTRYPOINT ["/service-ui"]
1 change: 0 additions & 1 deletion Dockerfile-k8s
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ LABEL quay.expires-after=1w
COPY bin/service-ui /
COPY app/build /public


ENV RP_STATICS_PATH=/public

EXPOSE 8080
Expand Down
5 changes: 1 addition & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ node {
stage('Push to ECR') {
withEnv(["AWS_URI=${AWS_URI}", "AWS_REGION=${AWS_REGION}"]) {
sh 'docker tag reportportal-dev/service-ui ${AWS_URI}/service-ui'
sh 'docker tag reportportal-dev/service-ui ${LOCAL_REGISTRY}/service-ui'
sh 'docker push ${LOCAL_REGISTRY}/service-ui'
def image = env.AWS_URI + '/service-ui'
def url = 'https://' + env.AWS_URI
def credentials = 'ecr:' + env.AWS_REGION + ':aws_credentials'
Expand All @@ -42,10 +40,9 @@ node {

stage('Cleanup') {
docker.withServer("$DOCKER_HOST") {
withEnv(["AWS_URI=${AWS_URI}", "LOCAL_REGISTRY=${LOCAL_REGISTRY}"]) {
withEnv(["AWS_URI=${AWS_URI}"]) {
sh 'docker rmi ${AWS_URI}/service-ui:SNAPSHOT-${BUILD_NUMBER}'
sh 'docker rmi ${AWS_URI}/service-ui:latest'
sh 'docker rmi ${LOCAL_REGISTRY}/service-ui:latest'
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions Jenkinsfile-candidate
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ node {
}
}
}

stage('Cleanup') {
docker.withServer("$DOCKER_HOST") {
withEnv(["AWS_URI=${AWS_URI}"]) {
sh 'docker rmi ${AWS_URI}/service-ui:${VERSION}-RC-${BUILD_NUMBER}'
sh 'docker rmi ${AWS_URI}/service-ui:latest'
}
}
}
}
}

Loading

0 comments on commit 757693b

Please sign in to comment.