I got an error with the job mobsf-android-sast, do i miss some configurations for mobsf?
Log:
$ /analyzer run
[INFO] [MobSF] [2022-06-17T14:02:46Z] ▶ GitLab MobSF analyzer v3.0.0
......
......
[INFO] [MobSF] [2022-06-17T14:02:49Z] ▶ Zipping: keystore.properties
[INFO] [MobSF] [2022-06-17T14:02:49Z] ▶ Zipping: sonar-project.properties
[FATA] [MobSF] [2022-06-17T14:02:49Z] ▶ failed to upload archive to mobsf: error requesting scan: Post "http://localhost:8000/api/v1/upload": dial tcp [::1]:8000: connect: connection refused
Uploading artifacts for failed job
Uploading artifacts...
WARNING: gl-sast-report.json: no matching files
ERROR: No files to upload
Cleaning up project directory and file based variables
ERROR: Job failed: command terminated with exit code 1
.gitlab-ci.yml
include:
- template: Security/SAST.gitlab-ci.yml
variables:
SAST_EXPERIMENTAL_FEATURES: "true"
sast:
stage: test
variables:
SAST_EXPERIMENTAL_FEATURES: "true"
DS_DISABLE_DIND: "true"
sast:
stage: test
dependencies:
- build
artifacts:
reports:
sast: gl-sast-report.json
paths:
- gl-sast-report.json
tags:
- docker
try this one
Related
I am trying to make CI process with GitHub Actions for Android project. Before making a real process, the goal is to build gradle and debug apk file automatically.
The job succeed for each step, however, neither build directory nor apk file is being created.
I read various posts and tried each post suggests, but nothing gave me a solution.
What part do I need to change to get the desired result?
Firstly, Below is log I got from ./gradlew build command. It says that the process definitely has gotten into :app:build
> Task :app:lintDebug
> Task :app:lint
> Task :app:check
> Task :app:build
BUILD SUCCESSFUL in 1m 22s
And here is a GitHub Actions Job I made.
Android_CI_Test.yml
name: Android CI Test
on:
pull_request:
branches:
- main
- release
- dev
- staging
push:
branches:
- main
- release
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: Set Up java
id: set_up_java
uses: actions/setup-java#v3
with:
java-version: 11
distribution: "corretto"
- name: Set Android SDK
uses: android-actions/setup-android#v2
- name: Cache Gradle
uses: actions/cache#v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grand Gradlew Permission
id: grand_gradlew_permission
run: chmod +x ./gradlew
- name: Validate Gradlew
id: validate_gradlew
uses: gradle/wrapper-validation-action#v1
- name: Set Up Gradle
id: set_up_gradle
uses: gradle/gradle-build-action#v2
- name: Build
id: build_gradle
run: ./gradlew build
- name: Build debug APK
id: build_debug_apk
run: ./gradlew assembleDebug --stacktrace
I tried changing Grand Gradlew Permission to chmod +x ./gradlew , changing Build debug APK to bash ./gradlew assembleDebug or ./gradlew app:assembleDebug but none of them has succeeded.
I enabled the pipleline and created the bitbuket-pipelines.yaml for my android project in bitbucket repo.
The pipeline build seems started fine and I can see the gradle tasks are being executed in the output console, just like executing the same gradlew build on my local machine:
./gradlew assembleQADebug
however, one of the task failed in the bitbucket cloud, I read the error, it is for the Jetpack Navigigation component SafeArgs:
...
> Task :app:compileQADebugKotlin
e: /opt/atlassian/pipelines/agent/build/.../AaaFragment.kt: (71, 86): Unresolved reference: actionAbcFragment
e: /opt/atlassian/pipelines/agent/build/.../XxxFragment.kt: (73, 86): Unresolved reference: actionZzzFragment
e: ...
Any tips or guess how to find out why this works in local but failed in fail in bitbucket pipleline?
The following is my simple yaml file:
image: androidsdk/android-31
pipelines:
branches:
playground/bitbucketbuild:
- parallel:
- step:
name: Build Android
memory: 2048
caches:
- gradle
script:
- cd $PROJ_ROOT && ./gradlew assembleQADebug #- ./gradlew clean bundleQARelease
- echo $PWD && ls -R app/build/outputs
- step: # step to run unit tests
name: Unit Tests
caches:
- gradle
script:
- cd $PROJ_ROOT && ./gradlew test
I'm trying to setup CI on Gitlab. I've got a problem. Looks like runner is working well but each time I try to run pipeline it fails with following error :
Running with gitlab-runner 14.4.0 (4b9e985a)
on local-runner g_SbFiLZ
Resolving secrets
00:00
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on GU33...
Getting source from Git repository
00:02
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in C:/Users/xxx/GitLab-Runner/builds/g_SbFiLZ/0/xxx/xxx/.git/
Checking out f4fb6ec9 as main...
git-lfs/2.11.0 (GitHub; windows amd64; go 1.14.2; git 48b28d97)
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ gem install bundler
gem : The term 'gem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s
pelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\WINDOWS\TEMP\build_script461193448\script.ps1:225 char:1
+ gem install bundler
+ ~~~
+ CategoryInfo : ObjectNotFound: (gem:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1
I have Ruby installed and setup correctly. I can run gem commands locally. Runner is also set locally so I really dont understand the issue. Here's my gitlab-ci.yml :
stages:
- prepare
- build
- test
- ui-test
variables:
LC_ALL: "en_US.UTF-8"
LANG: "en_US.UTF-8"
.setup_bundler: &setup_bundler |
gem install bundler
bundle config
bundle install
.setup: &setup
- *setup_bundler
prepare_project:
stage: prepare
script:
*setup
cache:
key:
files:
- Gemfile.lock
paths:
- vendor
artifacts:
name: "Bundle_${CI_BUILD_NAME}_${CI_COMMIT_REF_NAME}_${CI_BUILD_ID}"
expire_in: 1 day
paths:
- vendor
when: always
when: on_success
tags:
- android
build:
stage: build
script:
- bundle exec fastlane build
dependencies:
- prepare_project
tags:
- android
test:
stage: test
script:
- bundle exec fastlane tests
dependencies:
- prepare_project
tags:
- android
ui-test:
stage: ui-test
script:
- bundle exec fastlane ui_tests
dependencies:
- prepare_project
tags:
- android
Any ideas, pelase ?
It's likely that when you're running gem to debug, you're running it with a different user than gitlab-runner, which is the default gitlab-runner user. Check the PATH setup of your gitlab-runner user, and ensure that gem is on the path.
I am using the Gitlab-ci for the creating the build on the push,I have also creating the .gitlab-ci.yml inside my root directory. With each push the code on the Gitlab , i am getting the following message which are as follow
This job is stuck because you don't have any active runners that can run this job.
I have already enable the Shared Runners in the Setting getting above problem like Not having active member.
Please check my gitlab-ci.yml file data
image: jangrewe/gitlab-ci-android
stages:
- build
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
build:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
My all push suspended to create the build , please check it once.
Even though i have created the runner manually but they become fail to execute and getting following excetion
ERROR: Job failed (system failure): getting Kubernetes config: invalid configuration: no configuration has been provided
Please help me to short out from the problem. Thanks
If you have active shared-runner, then try to give the tags of the runner in the .gitlab-ci.yml. Say if the tag for the shared-runner is dev-ci, then find below the updated code:
image: jangrewe/gitlab-ci-android
stages:
- build
before_script:
- export GRADLE_USER_HOME=$(pwd)/.gradle
- chmod +x ./gradlew
cache:
key: ${CI_PROJECT_ID}
paths:
- .gradle/
build:
stage: build
tags:
- dev-ci
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
Screenshot of the runner tags:
Setting up a runner
Before setting up a runner for your project, you need to first:
Install gitlab-runner on a server separate than where GitLab is installed.
Register a runner [there are 3 types of runners: shared, group and specific runners. Depending on requirement, you can choose which runner to register.]
While registering the runner, you need to give tags and the type of runner executor you need.
After registering the runner, go to Project >> Settings >> CI/CD >> Runners, you can see the runner is online. If in case you are using Group or Shared runner, then you need to enable the runner in Project settings.
In your case, you can use Specific Runner with Docker as Runner-Executor and then, in the .gitlab-ci.yml use the tags you provided while registering the runner.
I am new to Android builds with AppCenter and wish to execute all my Apps JUnits.
My app consists of multiple modules that each have their associated JUnits.
However my main App module has no JUnits.
I've tried creating an appcenter-post-build.sh script to execute command ./gradlew test
which fails as follows:-
[command]/bin/bash /Users/runner/work/1/s/app/appcenter-post-build.sh
/Users/runner/work/1/s/app/appcenter-post-build.sh: line 5: ./gradlew: No such file or directory
##[error]The process '/bin/bash' failed with exit code 127
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 127
is there any way I can execute all my Apps modules JUnits via a post build script?
try to add this in your shell script.
cd $APPCENTER_SOURCE_DIRECTORY
chmod a+x ./gradlew