Skip to content

Commit

Permalink
Merge branch 'main' into B-21583-gbloc-AK-moves
Browse files Browse the repository at this point in the history
  • Loading branch information
pambecker authored Feb 7, 2025
2 parents d24ddd4 + 3ada8c6 commit 197ae63
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 57 deletions.
119 changes: 105 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
variables:
#Docker config
DOCKER_AUTH_CONFIG: "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD\"}}}"
DOCKER_APP_IMAGE: milmove01/transcom-docker:milmove-app
#hard code sha as newer version of debian is needed for pre-test
DOCKER_APP_IMAGE: milmove01/transcom-docker:milmove-app@sha256:ee774e9244afa2063bbbb7f9b973b17f1f5139366a1b7a676155df0b5268a7e1
DOCKER_BASE_IMAGE: milmove01/transcom-docker:base
DOCKERHUB_USERNAME: DOCKERHUB_USERNAME
DOCKERHUB_PASSWORD: DOCKERHUB_PASSWORD
Expand All @@ -24,7 +25,7 @@ variables:
#CIRCLE_TOKEN: "$GITLAB_API_TOKEN" # GitLab API token for querying pipelines
CIRCLE_BUILD_NUM: "$CI_PIPELINE_ID"

GOPATH: "$CI_PROJECT_DIR/go"
GOPATH: "/home/transcom/go" #Go path on the app image
GOLANGCI_LINT_CONCURRENCY: "4"
GOLANGCI_LINT_VERBOSE: "-v"

Expand Down Expand Up @@ -63,7 +64,7 @@ stages:
#set safe directory and path
.setup_milmove_env: &setup_milmove_env
- git config --global --add safe.directory /builds/milmove/mymove
- export PATH=${PATH}:${GOPATH}/bin:~/transcom/mymove/builds/milmove/mymove:/builds/milmove/mymove/scripts
- export PATH=${PATH}:${GOPATH}/bin:~/transcom/mymove/builds/milmove/mymove:/builds/milmove/mymove/scripts:/builds/milmove/mymove/bin
- export REACT_APP_ERROR_LOGGING=otel

.announce_failure: &announce_failure
Expand Down Expand Up @@ -254,6 +255,7 @@ stages:
export OKTA_API_KEY=notrealapikey8675309
export OKTA_OFFICE_GROUP_ID=notrealgroupId
export OKTA_CUSTOMER_GROUP_ID=notrealcustomergroupId
export IWS_RBS_HOST=pkict.dmdc.osd.mil
.setup_env_intergration_mtls: &setup_env_intergration_mtls
- |
Expand Down Expand Up @@ -389,6 +391,89 @@ pre_deps_golang:
# - $GOPATH/pkg/mod
# - /builds/milmove/mymove/bin # Ensure this path is correct and writable.
# Optionally, you can define an after_script for cleanup or notifications.
golang_lint:
stage: pre_checks
interruptible: true
tags:
- $DOCKER_RUNNER_TAG
image: golangci/golangci-lint:latest # Refer to https://hub.docker.com/r/golangci/golangci-lint
script:
- golangci-lint run --print-issued-lines=false --timeout=25m --out-format code-climate:gl-code-quality-report.json,line-number
artifacts:
reports:
codequality: gl-code-quality-report.json
paths:
- gl-code-quality-report.json
when: always
allow_failure: true

# WIP but failing and will need to get back to see if this is a viable option for go test coverage
# golang_coverage:
# stage: pre_checks
# interruptible: true
# tags:
# - $DOCKER_RUNNER_TAG
# image: $DOCKER_APP_IMAGE
# services:
# - name: docker:dind
# alias: docker
# - name: $postgres
# - name: $redis
# before_script:
# - *setup_milmove_env
# variables:
# KUBERNETES_CPU_REQUEST: "4"
# KUBERNETES_MEMORY_REQUEST: "8Gi"
# KUBERNETES_MEMORY_LIMIT: "8Gi"
# DOCKER_HOST: "tcp://docker-backend.gitlab-runner.svc.cluster.local:2375"
# DOCKER_TLS_CERTDIR: ""
# APPLICATION: app
# # 8 since this runs on xlarge with 8 CPUs
# GOTEST_PARALLEL: 8
# DB_PASSWORD: mysecretpassword
# DB_USER_LOW_PRIV: crud
# DB_PASSWORD_LOW_PRIV: mysecretpassword
# DB_USER: postgres
# DB_HOST: localhost
# DB_PORT_TEST: 5432
# DB_PORT: 5432
# DB_NAME: test_db
# DB_NAME_TEST: test_db
# DTOD_USE_MOCK: 'true'
# MIGRATION_MANIFEST: '/builds/milmove/mymove/migrations/app/migrations_manifest.txt'
# MIGRATION_PATH: 'file:///builds/milmove/mymove/migrations/app/schema;file:///builds/milmove/mymove/migrations/app/secure'
# EIA_KEY: db2522a43820268a41a802a16ae9fd26 # dummy key generated with openssl rand -hex 16
# ENV: test
# ENVIRONMENT: test
# SERVER_REPORT: 1
# COVERAGE: 1
# SERVE_API_INTERNAL: 'true'
# OKTA_CUSTOMER_CLIENT_ID: 1q2w3e4r5t6y7u8i9o
# OKTA_ADMIN_CLIENT_ID: AQ1SW2DE3FR4G5
# OKTA_OFFICE_CLIENT_ID: 9f9f9s8s90gig9
# OKTA_API_KEY: notrealapikey8675309
# OKTA_OFFICE_GROUP_ID: notrealgroupId
# OKTA_CUSTOMER_GROUP_ID: notrealcustomergroupId
# POSTGRES_DB: test_db #for postgres container
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: mysecretpassword
# POSTGRES_HOST_AUTH_METHOD: trust
# DPS_AUTH_SECRET_KEY: placeholder
# CSRF_AUTH_KEY: d096fd8529eefaa46497849d11d2ff2e979ddfaed1aff058524ada9bceadd67c
# IWS_RBS_ENABLED: 0
# IWS_RBS_HOST: "pkict.dmdc.osd.mil"
# script:
# - go test ./... -coverprofile=coverage.txt -covermode count
# - go get github.com/boumenot/gocover-cobertura
# - go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
# allow_failure: true
# after_script:
# - *announce_failure
# artifacts:
# reports:
# coverage_report:
# coverage_format: cobertura
# path: /builds/milmove/mymove/coverage.xml

pre_deps_yarn:
stage: pre_checks
Expand Down Expand Up @@ -698,7 +783,7 @@ server_test:
DB_PASSWORD_LOW_PRIV: mysecretpassword
DB_USER: postgres
DB_HOST: localhost
DB_PORT_TEST: 5433
DB_PORT_TEST: 5432
DB_PORT: 5432
DB_NAME: test_db
DB_NAME_TEST: test_db
Expand All @@ -717,18 +802,22 @@ server_test:
OKTA_API_KEY: notrealapikey8675309
OKTA_OFFICE_GROUP_ID: notrealgroupId
OKTA_CUSTOMER_GROUP_ID: notrealcustomergroupId
POSTGRES_DB: test_db #for postgres container
POSTGRES_USER: postgres
POSTGRES_PASSWORD: mysecretpassword
POSTGRES_HOST_AUTH_METHOD: trust
DPS_AUTH_SECRET_KEY: placeholder
CSRF_AUTH_KEY: d096fd8529eefaa46497849d11d2ff2e979ddfaed1aff058524ada9bceadd67c
IWS_RBS_ENABLED: 0
IWS_RBS_HOST: "pkict.dmdc.osd.mil"
script:
- psql --version
- for i in $(seq 1 5); do go mod download && break || s=$? && sleep 5; done; (exit $s)
- scripts/check-generated-code go.sum
- make bin/swagger
- echo "server test -- TODO Add steps need to potentially pass job id to file and persist"
- echo "server test -- build gotestsum and run scripts for report"
- make -j 2 bin/milmove bin/gotestsum
- make server_test for app
# - go install gotest.tools/gotestsum@latest
# - go mod tidy
#- bin/gotestsum --junitfile server_test_report.xml --format server_test
allow_failure: true
allow_failure: true #leaving true until 5 tests failing tests are working
artifacts:
paths:
- /builds/milmove/mymove/bin/gotestsum
Expand All @@ -738,8 +827,9 @@ server_test:
junit: /builds/milmove/mymove/tmp/test-results/gotest/app/go-test-report.xml
after_script:
- *announce_failure
rules:
- *check_server_ignore_branch
# we want to make this run on every branch bc webhooks don't exist currently
# rules:
# - *check_server_ignore_branch

server_test_coverage:
stage: test
Expand Down Expand Up @@ -806,8 +896,9 @@ client_test:
- /builds/milmove/mymove/jest-junit-reports
after_script:
- *announce_failure
rules:
- *check_client_ignore_branch
# we want to make this run on every branch bc webhooks don't exist currently
# rules:
# - *check_client_ignore_branch

client_test_coverage:
stage: test
Expand Down
Loading

0 comments on commit 197ae63

Please sign in to comment.