How I can turn off warnings in Gitlab-ci? - gitlab

How can I skip these warnings in Gitlab-CI?
It spams all logs in pipeline.
WARNING: /opt/react/b57e2b5b781b5438a08ac93a288c49a0c6113e8c/node_modules/#mui/icons-material/esm/CenterFocusWeakOutlined.js: not supported: outside build directory

Perhaps you should fix the warning and not sweep under the carpet.
I refer to this answer: Gitlab CI - not supported: outside build directory
Summary:
GitLab only can package artifacts found in the $CI_PROJECT_DIR directory (/home/gitlab-runner/builds/Gso-uWvA/0/www/your_project).
Therefore, make sure your project and it's dependencies can be found in this path. Don't use absolute paths.
Gitlab-Documentary: https://docs.gitlab.com/ee/ci/pipelines/job_artifacts.html
Gitlab-Forum: https://forum.gitlab.com/t/warning-not-supported-outside-build-directory/3680/5

Related

Compile directory in Azure DevOps Repos and save the results somewhere

Let’s say I have a directory structure like this in an Azure DevOps repo:
Main/
- A/
- *.csproj
- B/
- *.csproj
- C/
- *.csproj
Each subfolder has a .csproj file. I want to compile the Main/A/ folder and save the build results (artifacts?) somewhere, be it a folder or something else. How do I tell Azure to build that precise Main/A/*.csproj file and do I need to use /p:OutputPath inside the VSBuild#1 task, or do I need to use some other Azure task?
How do I tell Azure to build that precise Main/A/*.csproj file and do
I need to use /p:OutputPath inside the VSBuild#1 task
If you're using classic UI, you need to unlink the default solution:
And then choose the A project by the browse option:
If you're using Yaml format, you should use something like solution: A/A.csproj to specify which project to build.
Note:
Since now we're building single project instead of whole solution, we should use Project Configuration instead of Solution Configuration. any cpu is Solution Platform instead of Project Platform(AnyCPU). So we should make sure we're building single project with AnyCPU if we want to build one project with this setting.
If you got error The OutputPath property is not set for project 'A.csproj', that indicates you should use valid project configuration. In your case, if you're using any cpu, change it to AnyCPU.
In addition:
1.To publish the build results as build artifacts for further use. You can use Copy Files task and Publish Build Artifacts task like this:
Copy Files Task.
Publish Build Artifacts
Then you can download the Test.zip in Summary tab from build log page. Also, you can use this artifact in release pipeline by using download artifacts task.
Check this, if you're trying build code project instead of whole solution. You can consider MSBuild Task. They(Msbuild task,VS Build task) both calls msbuild.exe to do the build job.
Hope all above helps :)

How to properly communicate different stages in a CI/CD pipeline

I'm struggling to make work a simple CI/CD pipeline with dependencies between stages. This is my .gitlab-ci.yml file:
image: gcc
stages:
- build
- test
build_app:
stage: build
script:
- make
- make install
test_app:
stage: test
script:
- run app ...
dependencies:
- build_app
So the build stage will compile the application and install it under /usr/local/bin/. The above example will fail because the test stage does not find the executable, even when it is states as dependent on the build step (it seems it is not attached by default).
If I define /usr/local/bin/app as an artifact it will also fail, because these must be relative and child of $CI_PROJECT_DIR (reference).
So I'm now trying to do some modifications on it but I feel I do not really understand what is going on there. I finally tried to attach the file compiled (APP) in the repository directory as an artifact (without using make install), and calling that binary for testing (eg. ./APP instead of APP). This way, it works, but I feel like I had to renounce to the make install instruction, and also that there is probably a much better and straightforward way to implement this.
Is there a recommended way to perform this task?
cache won't work either. It is restricted (though not documented) to the same limitations as artifacts.
These are both security measures since it would otherwise provide access to the entire filesystem the gitlab-ci-runner is installed.
The solution would be to install the binary in a path relative to your build directory instead of /usr/local/bin/app and use artifacts.

How to create a build pipeline for multi-module maven in Azure Devops

I have a multi-module maven project in azure repo:
Parent
----App
--POM.xml
----Core
--POM.xml
----API
--POM.xml
----ParentPOM.xml
When I tried to build App project in Azure, I am getting the following error: [ERROR] Failed to execute goal on the project: Could not resolve dependencies for project com.core:jar:1.0: Could not find artifact com.core:jar:1.0 in central (https://repo.maven.apache.org/maven2).
So I tried to create multiple tasks in the same azure build to package for each module (App, Core, API), which also gives the same result. Could someone please help me on how to build the multi-module project and get the App jar file.
The way I've done it:
with this command: install -pl (module name) -am
where the module name should be one of the submodules. If you want to build all of them then only go with install
I have found the solution for the multi-module maven dependency issue, First We need to build the parent pom.xml, then build the submodules as per hierarchical order. In between each module, add a task to copy and move the jar files to the staging directory. Here shared the image of my build steps. Please take a look and comment on any questions.
Please look into the DevOps configuration for reference

Gitlab CI: Cannot find output of build stage

I have my .gitlab-ci.yml file set up in the typical three stages: test, build, deploy. During the build stage, I run a command that compiles my project and puts it in a tarball. The build stage appears to execute successfully because it moves on to the deploy stage, but the deploy stage then says it can't find the tarball. Is it in another directory? What happened to it? Thanks.
For each test gitlab-ci clean the build folder, therefore the output files of the build stage are not available in the deploy stage.
You need to rebuild your project also in the deploy stage.
The "stages" are only useful to order your tests, i.e. avoid to try to do a deploy test if a build test failed.
EDIT:
Since Gitlab 8.6, it is possible using dependencies feature
I was surprised to see the same behaviour (on GitLab 8.4).
I use cmake to create makefiles, then make to build, and then make test to run the test. I run all these in a build/ directory.
I don't want to repeat myself and identify easily which steps are failing. As such, I've created different gitlab-ci stages: cmake, make, test, etc. I then tell gitlab-ci to keep the build directory using the cache option:
cache:
key: "$CI_BUILD_REF_NAME"
untracked: true
paths:
- build/
I think that the key option will keep the same build directory for all stages acting on the same branch. See the gitlab-ci doc here: http://doc.gitlab.com/ce/ci/yaml/README.html#cache
EDIT: Don't use the cache for this! GitLab implemented reusable artifacts between stages in 8.4: https://gitlab.com/gitlab-org/gitlab-ce/issues/3423
The CI runners will have to be adapted to support this. See: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/336

Xcodebuild'ing a workspace and setting a custom build path

I'm trying to use xcodebuild to build a multi-project project in a workspace. When XCode builds a workspace it automatically places all build artifacts in a common directory in DerivedData so that each project can access it dependencies.
If I use this command:
xcodebuild -workspace myWorkspace.xcworkspace -schema builtIt -configuration Release
Eveything works, but the artifacts are placed in usual derived data directory. I want then to appear in a specific directory which I can access from CI builds. So I tried this
xcodebuild -workspace myWorkspace.xcworkspace -schema builtIt -configuration Release SYMROOT=build/products OBJROOT=build/intermediates
However xcodebuild fails with this saying
Details: Failed to load dependencies output contents from ``/Users/d4rkf1br3/projects/dNodi/build/intermediates/dNodi.build/Debug-iphoneos/dNodi.build/StaticAnalyzer/normal/armv7/DNRootSelector.d''.
Error: Error Domain=NSCocoaErrorDomain Code=260 "The file “DNRootSelector.d” couldn’t be opened because there is no such file."
UserInfo=0x4012fea40 {NSFilePath=/Users/d4rkf1br3/projects/dNodi/build/intermediates/dNodi.build/Debug-iphoneos/dNodi.build/StaticAnalyzer/normal/armv7/DNRootSelector.d, NSUnderlyingError=0x4012fc240 "The operation couldn’t be completed. No such file or directory"}.
User info: {
NSFilePath = "/Users/d4rkf1br3/projects/dNodi/build/intermediates/dNodi.build/Debug-iphoneos/dNodi.build/StaticAnalyzer/normal/armv7/DNRootSelector.d";
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
}
The problem appears to be that xcodebuild is no longer using a central directory for all projects in the workspace and is storing the artifacts in each project instead. Hence it cannot locate the dependencies between code being compiled and artifacts produced in other projects.
Does anyone know the correct parameter to set on the command line?
Xcode's Build Setting Reference has not been updated for two years so I don't know if there are new build settings I can apply.
I'm not sure if this is a new option but the 5.0 release of xcodebuild has an option -derivedDataPath which allows you to specify the directory you'd like all the build products to sit in.
For instance, passing -derivedDataPath build creates the folder build relative to where you ran xcodebuild from, and you can find your app predictably in a subfolder like build/Build/Products/Release-iphoneos.
Documentation: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
The best solution i have found so far is to use the CONFIGURATION_BUILD_DIR parameter with an ABSOLUTE path (e.g. /tmp/$PROJECT/build). Like this:
xcodebuild -scheme "scheme" -configuration Debug -sdk iphoneos clean build CONFIGURATION_BUILD_DIR=$ABSOLUTE_BUILD_PATH
I use Jenkins and there I have an variable named $WORKSPACE. With $WORKSPACE/build as my CONFIGURATION_BUILD_DIR I have a solution I'm happy with.
The relative paths don't seem to work as expected. We should file a bug report.
I also met this problem when I build my project from Jenkins CI tool. My main project depends a sub-project. I have tried building follow #Chilloutman's solution like this:
xcodebuild -target TravelGuideMdd -sdk iphoneos -configuration DailyBuild clean build CONFIGURATION_BUILD_DIR=/Users/mobileserver/jenkins_home/jobs/TravelGuide-Buid-For-Me/workspace/build BUILD_DIR =/Users/mobileserver/jenkins_home/jobs/TravelGuide-Buid-For-Me/workspace/build
or
xcodebuild -target TravelGuideMdd -sdk iphoneos -configuration DailyBuild clean build CONFIGURATION_BUILD_DIR=/Users/mobileserver/jenkins_home/jobs/TravelGuide-Buid-For-Me/workspace/build
Both of them occur errors Could not find iphoneos in /Users/mobileserver/jenkins_home/jobs/TravelGuide-Buid-For-Me/workspace/build
But I get success finally using this:
xcodebuild -target TravelGuideMdd -sdk iphoneos6.1 -configuration DailyBuild clean build SYMROOT=/Users/mobileserver/jenkins_home/jobs/TravelGuide-Buid-For-Me/workspace/build
That is: Setting the SYMROOT with a absolute paths.

Resources