Grab all artifacts from gitlab-ci dir and make them an artifact - gitlab

I am trying to display all the artifacts .html files in a specific directory:
$TOOLS_PATH/terraform_results/html that are generated during a build job stage when my gitlab pipeline is run.
when this is run in the gitlab pipeline I get a warning:
Uploading artifacts... WARNING: tools/terraform_results/html/*: no matching files
I'm invoking this via gitlab-ci.yml file via:
artifacts:
paths:
- "$TOOLS_PATH/terraform_results/html/*"
What am i doing wrong?

Drop the quotes and wildcard and indent the paths list. This will zip everything in the html folder. You can use wildcards like *.html to filter filenames if needed:
artifacts:
paths:
- $TOOLS_PATH/terraform_results/html/
If that doesn't work, read the gitlab-ci.yml reference on artifacts:paths to make sure you didn't miss anything. For example:
Paths are relative to the project directory ($CI_PROJECT_DIR) and can’t directly link outside it.
Make sure that the tools directory is located in the root of your project directory. You can confirm the directory exists by adding ls $CI_PROJECT_DIR to your scripts section and checking the runner logs.

For .html only files
artifacts:
paths:
- $TOOLS_PATH/terraform_results/html/*.html

Related

Getting nested directory artifact without getting nested parent directories in .gitlab-ci.yml?

I'm trying to get a nested directory's contents as a zipped artifact in my GitLab CI.
In this case, I want all files and directories within the myapp directory.
artifacts:
paths:
- ${CI_PROJECT_DIR}/application/windows/AppPackages/myapp/
The problem is that the outputted folder (screenshot below) includes the entire directory chain as well. I only want the contents of the myapp folder (circled).

Bitbucket-Laravel-Azure Web App: Artifacts not uploaded

Artifacts is not uploaded after successful test pipeline. What's wrong with the code below?
Here's the result:
You are using a variable in your artefact name, which is currently not supported. As artifacts section is a separate post-script behaviour, your Test step is perfectly green.
To solve the issue, use a constant name for your artefact. Alternatively, you can combine the packaging and deployment steps into a single one:
script:
- echo "Packaging and deploying to test environment"
- zip -r example-$BITBUCKET_BUILD_NUMBER.zip .
- pipe: ...
This advice works https://stackoverflow.com/a/72570848/14740671 but I need to separate the deployment. I also tried uploading the file using this code:
- pipe: atlassian/bitbucket-upload-file:0.3.2
variables:
BITBUCKET_USERNAME: $BITBUCKET_UPLOAD_USERNAME
BITBUCKET_APP_PASSWORD: $BITBUCKET_UPLOAD_PWD
FILENAME: "example-1.zip"
It has no errors but file is still no seen in the Artifacts and azure deployments has "FileNotFoundError: [Errno 2] No such file or directory: '/opt/atlassian/pipelines/agent/build/example-1.zip'"

gitlab: how can i programmatically upload the artifacts to gitlab registry

I have jfrog backup with the below format:
./repositories
./repositories/digital
./repositories/digital/admin
./repositories/digital/admin/revealjs-digital-signage
./repositories/digital/admin/revealjs-digital-signage/v1.artifactory-metadata
./repositories/digital/admin/revealjs-digital-signage/v1.artifactory-metadata/artifactory-folder.xml
./repositories/digital/admin/revealjs-digital-signage/_uploads
./repositories/digital/admin/revealjs-digital-signage/v1
./repositories/digital/admin/revealjs-digital-signage/v1/sha256__6b8971be6dd8206db197c075c2078e750466e8c8086a6781363b3b509236b127.artifactory-metadata
./repositories/digital/admin/revealjs-digital-signage/v1/sha256__6b8971be6dd8206db197c075c2078e750466e8c8086a6781363b3b509236b127.artifactory-metadata/properties.xml
./repositories/digital/admin/revealjs-digital-signage/v1/sha256__6b8971be6dd8206db197c075c2078e750466e8c8086a6781363b3b509236b127.artifactory-metadata/artifactory-file.xml
./repositories/digital/admin/revealjs-digital-signage/v1/sha256__c5ec31d8205545276d3ec1e2a8a77308aa52865dda22241b8e32d4e46daaf82a
./repositories/digital/admin/revealjs-digital-signage/v1/sha256__91cedd97621ca699948e
I need a way or tool that can migrate Jfrog artifacts to gitlab.
You can tell the runner to upload any files or directories you need like this:
artifacts:
paths:
- ./repositories/
The full documentation for the artifact keyword is here: https://docs.gitlab.com/ee/ci/yaml/#artifacts

How to run CI job only if two files have been changed? [not one or another]

I have task to create simple GitLab CI file to run a job only if two files have been changed. In official GitLab docs I have not found nothing about this. I need to run a job only if file A changed and also file B changed.
In this case, you don't have to change by yourself, every time if you change/commit your File A and File B, GitLab CI will allow your files to automatically run as a job
Option A - Only/Except https://docs.gitlab.com/ee/ci/yaml/#onlyexcept-advanced
This is the correct way to do it
your-step:
script:
- your-script.sh
only:
changes:
- "file*.extension" # I don't know the pattern of your files
Option B - Using shell script
You can do anything with shell script (or any other language)
in this link https://gitlab.com/gitlab-org/gitlab-foss/-/issues/19813 you will see a lot of options to do it. Just try if something fits to your purpose
Option C - Using gitlab rules https://docs.gitlab.com/ee/ci/yaml/#rules
In the example below, the job will be triggered if any of the conditions match
your-step:
script:
- your-script.sh
rules:
- changes:
- fileA
- file B
- dir-with-both-files/*

GitLab Pages deployment step fails after successfull build

I am trying to host a reveal.js presentation via gitlab pages. The repository can be found here: https://gitlab.com/JanGregor/demo-slides
My .gitlab-ci.yml is fairly simple:
image: node:4.2.2
pages:
cache:
paths:
- node_modules/
script:
- npm install
- node_modules/.bin/gulp
artifacts:
paths:
- build
only:
- master
After a commit to master though, something goes wrong. The pages task itself is executed and runs just fine. It even shows in the logs that my build directory has been scanned and that the artefacts have been found.
Oddly, the subsequent pages:deploy task fails. It only says :
pages failed to extract
Any help would be greatly appreciated, since I have no clue where to look to next. The documentation itself isn't really helpful when trying to implement an deployment flow with npm.
Thanks in advance folks !
Apparently a page can only be published from a folder in under the artifacts that is called "public".
From the GitLab Pages documentation:
To make use of GitLab Pages, the contents of .gitlab-ci.yml must follow the rules below:
A special job named pages must be defined
Any static content which will be served by GitLab Pages must be placed under a public/ directory
artifacts with a path to the public/ directory must be defined
Also mentioned (somewhat tangentially) in the "GitLab Pages from A to Z" guide:
... and GitLab Pages will only consider files in a directory called public.

Resources