Gitlab: Unable to download artifact using URL - gitlab

I am trying to download an artifact using the URL method.
InGitLab, I'm getting the following error:
117$ https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make_patch
118/bin/bash: line 100: https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make_patch: No such file or directory
Code:
job_make:
tags:
- test123
image: node:10.19
stage: build
script:
- npm install
- make
- make source-package
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
artifacts:
when:
paths:
- test.tar.bz2
expire_in: 2 days
job_test_patch:
tags:
- test123
stage: deploy
image: mycustomerdockerimage
script:
- https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make
- ls -lah
My project is internal and everyone with access can see it.
also i've made sure to check off "public pipelines" in the project settings.
When I manually try a curl call this is what I get:
PS C:\Users\jj\> curl -v https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make
VERBOSE: GET https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make with 0-byte payload
VERBOSE: received -1-byte response of content type text/html; charset=utf-8
PS C:\Users\jj\> curl -v https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make
VERBOSE: GET https://gitlab.myserver.com/mynamespace/jt/-/jobs/artifacts/master/download?job=job_make with 0-byte payload
VERBOSE: received -1-byte response of content type text/html; charset=utf-8
StatusCode : 200
StatusDescription : OK
Content : <!DOCTYPE html>
<html class="devise-layout-html">
<head prefix="og: http://ogp.me/ns#">
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="object" property="o...
RawContent : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Referrer-Policy: strict-origin-when-cross-origin,strict-origin-when-cross-origin
X-Content-Type-Options: no...
Forms : {new_user}
Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Vary, Accept-Encoding], [Referrer-Policy, strict-origin-when-cross-origin,strict-origin-when-cross-origin]...}
Images : {}
InputFields : {#{innerHTML=; innerText=; outerHTML=<input name="utf8" type="hidden" value="✓">; outerText=; tagName=INPUT; name=utf8; type=hidden; value=✓}, #{innerHTML=; innerText=;
outerHTML=<input name="authenticity_token" type="hidden" value="OncopKrJ1jOr+BsMQdWIPNaJjoWvkAia6rHR6hUexNoyHJiBUfMVPm+ww0HqAn7h9oRtRqVdcoLgSxZYotJsxg==">; outerText=; tagName=INPUT;
name=authenticity_token; type=hidden; value=OncopKrJ1jOr+BsMQdWIPNaJjoWvkAia6rHR6hUexNoyHJiBUfMVPm+ww0HqAn7h9oRtRqVdcoLgSxZYotJsxg==}, #{innerHTML=; innerText=; outerHTML=<input
name="user[login]" title="This field is required." class="form-control top" id="user_login" autofocus="autofocus" required="required" type="text" data-qa-selector="login_field"
autocorrect="off" autocapitalize="off">; outerText=; tagName=INPUT; name=user[login]; title=This field is required.; class=form-control top; id=user_login; autofocus=autofocus;
required=required; type=text; data-qa-selector=login_field; autocorrect=off; autocapitalize=off}, #{innerHTML=; innerText=; outerHTML=<input name="user[password]" title="This field is
required." class="form-control bottom" id="user_password" required="required" type="password" data-qa-selector="password_field">; outerText=; tagName=INPUT; name=user[password];
title=This field is required.; class=form-control bottom; id=user_password; required=required; type=password; data-qa-selector=password_field}...}
Links : {#{innerHTML=Sign in; innerText=Sign in; outerHTML=<a class="nav-link active" role="tab" href="#login-pane" data-qa-selector="sign_in_tab" data-toggle="tab">Sign in</a>;
outerText=Sign in; tagName=A; class=nav-link active; role=tab; href=#login-pane; data-qa-selector=sign_in_tab; data-toggle=tab}, #{innerHTML=Forgot your password?; innerText=Forgot
your password?; outerHTML=Forgot your password?; outerText=Forgot your password?; tagName=A; href=/users/password/new}, #{innerHTML=Explore;
innerText=Explore; outerHTML=Explore; outerText=Explore; tagName=A; href=/explore}, #{innerHTML=Help; innerText=Help; outerHTML=Help;
outerText=Help; tagName=A; href=/help}...}
ParsedHtml : System.__ComObject
RawContentLength : 9914
There's basically one zip file in the artifacts repo that I'm trying to grab.
Thanks.

The script as shown in the question seems to be missing the curl part:
script:
- curl -kL https://....
^^^^^^^^
The documentation mentions
The structure of the URL to download the whole artifacts archive is the following:
https://example.com/<namespace>/<project>/-/jobs/artifacts/<ref>/download?job=<job_name>
So your URL should work, provided you are using curl in said script.

Related

Ansible- How to show authentication token after adding user to using post?

I am trying to add user to db the response shows authentication token, but i see some errors that dont print anyting from debug. Any Idea why? any help is Welcome.
Heres the playbook-
- name: uri module demo
hosts: localhost
become: false
vars:
server: "http://localhost:8080"
endpoint: "/api/v1/users"
tasks:
- name: list applicant by id
ansible.builtin.uri:
url: "{{ server }}{{ endpoint }}"
method: POST
body_format: json
body: '{
"firstName":"user1",
"lastName":"localuser",
"mobile":"9090909090",
"password":"12121212",
"roleId":"1",
"roleCode":"helpdesk_user"}'
status_code: 200
timeout: 30
register: result
- debug:
msg: "{{ result.json.token }}"
Output after running playbook
linux:~$ ansible-playbook ansible_api_test.yml
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
'all'
PLAY [uri module demo] ***********************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************
ok: [localhost]
TASK [list applicant by id] ******************************************************************************************
ok: [localhost]
TASK [debug] *********************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'token'\n\nThe error appears to be in '/home/ansible_api_test.yml': line 27, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - debug:\n ^ here\n"}
PLAY RECAP ***********************************************************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

Webpacker can't find application.js in /app/public/packs/manifest.json and I can't precompile assets after deleting node_modules folder

I am using Ruby 2.7.1, Rails 5.2, Webpacker 5.4.3. I have just installed Stimulus and Webpacker to add a bit of functionality.
I'm only using scss and not via webpacker. All I have added webpacker for is one single stimulus controller and action.
I have also added the nodejs buildpack to Heroku, and it is placed above my Ruby buildpack.
It's all working fine locally, but when I deploy to Heroku I'm getting the error below.
I have tried most of the SO threads, including all of the steps in Rails: Webpacker 4.2 can't find application in /app/public/packs/manifest.json heroku
I then get this other error when loading a page:
ActionView::Template::Error (Webpacker can't find application.js in /app/public/packs/manifest.json. Possible causes:
2022-02-17T00:23:41.046861+00:00 app[web.1]: 1. You want to set webpacker.yml value of compile to true for your environment
2022-02-17T00:23:41.046862+00:00 app[web.1]: unless you are using the `webpack -w` or the webpack-dev-server.
2022-02-17T00:23:41.046862+00:00 app[web.1]: 2. webpack has not yet re-run to reflect updates.
2022-02-17T00:23:41.046863+00:00 app[web.1]: 3. You have misconfigured Webpacker's config/webpacker.yml file.
2022-02-17T00:23:41.046863+00:00 app[web.1]: 4. Your webpack configuration is not creating a manifest.
2022-02-17T00:23:41.046864+00:00 app[web.1]: Your manifest contains:
2022-02-17T00:23:41.046864+00:00 app[web.1]: {
2022-02-17T00:23:41.046864+00:00 app[web.1]: }
2022-02-17T00:23:41.046865+00:00 app[web.1]: ):
2022-02-17T00:23:41.049630+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 7:
2022-02-17T00:23:41.049632+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 8: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
2022-02-17T00:23:41.049633+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 9: <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
2022-02-17T00:23:41.049645+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 10: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
2022-02-17T00:23:41.049652+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 11: <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
2022-02-17T00:23:41.049652+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 12:
2022-02-17T00:23:41.049653+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] 13: <%= action_cable_meta_tag %>
2022-02-17T00:23:41.049678+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a]
2022-02-17T00:23:41.049817+00:00 app[web.1]: [b001178d-5a2c-4b96-b887-d38510bf610a] app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb___2567613171312260909_150400'
My webpacker.yml:
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app/javascript
source_entry_path: packs
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
webpack_compile_output: true
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
additional_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
# Extract and emit a css file
extract_css: false
static_assets_extensions:
- .jpg
- .jpeg
- .png
- .gif
- .tiff
- .ico
- .svg
- .eot
- .otf
- .ttf
- .woff
- .woff2
extensions:
- .mjs
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
headers:
'Access-Control-Allow-Origin': '*'
watch_options:
ignored: '**/node_modules/**'
test:
<<: *default
compile: true
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: true
# Extract and emit a css file
extract_css: false
# Cache manifest.json for performance
cache_manifest: true
Application.html.erb:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<%= csrf_meta_tags %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<%= action_cable_meta_tag %>
<%= render 'content/cookie_consent' %>
</head>
manifest.json from heroku server:
{
"application.js": "/packs/js/application-7cfb688d908cd6b44d3a.js",
"application.js.map": "/packs/js/application-7cfb688d908cd6b44d3a.js.map",
"entrypoints": {
"application": {
"js": [
"/packs/js/application-7cfb688d908cd6b44d3a.js"
],
"js.map": [
"/packs/js/application-7cfb688d908cd6b44d3a.js.map"
]
}
}
}
app/javascript/packs/application.js:
import "controllers"
import '../stylesheets/application'; // have tried it both with and without this included
Could you provide your full webpacker.yml?
Maybe you're missing something in the default?
default: &default
source_path: app/javascript
source_entry_path: packs
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: true
Maybe this could help?
https://github.com/rails/webpacker/issues/2674
I'm not sure how this ended up getting resolved.
I updated my Ruby to 2.7.5 from 2.7.1
bundle install
I had a message to install Graphviz, to gemfile I added:
gem 'ruby-graphviz', '~> 1.2', '>= 1.2.3'
bundle install
locally ran:
rake assets:precompile
Added to gemfile.lock
PLATFORMS
x86_64-darwin-21 //this existed
x86_64-linux //this was added
Pushed to Heroku and it worked.
Encountered this issue when installing the packages using npm via npm install. Switched to yarn via yarn install and its all working for me.
Using rails version 6.1.6 btw.

Express.js GET request failing when proved with longer request

I have a big deeply nested JS object that is send to the Express.js server after it gets JSON.strify() and turned it into an string. I tried the same thing with a smaller and shallowly nested object, then it worked fine.
Here's the big object:
{
channelName: 'PewDiePie',
channelTag: 'UC-lHJZR3Gqxm24_Vd_AJ5Yw',
channelLogoLink: 'https://yt3.ggpht.com/a/AATXAJzlZzr16izsGHBCHIkO3H7n-UiHyZPCJFEPiQ=s88-c-k-c0xffffffff-no-rj-mo',
unseenVideoTitles: [
[
'I Made The WORST Minecraft MISTAKE There Is. .. - Part 40',
'The MOST Dangerous Place In Minecraft!',
'I Found The New Biome in Minecraft! (Nether Update)',
'I\'m Back in Minecraft! - Part 39'
]
],
videoThumbnailLinks: [
[
'https://i.ytimg.com/vi/8HHZiNdrZGA/mqdefault.jpg',
'https://i.ytimg.com/vi/evcMQ7Lk8NU/mqdefault.jpg',
'https://i.ytimg.com/vi/aOXAtnb-grk/mqdefault.jpg',
'https://i.ytimg.com/vi/1B1f9PGLbIs/mqdefault.jpg'
]
],
videoLinks: [
[
'https://www.youtube.com/watch?v=8HHZiNdrZGA',
'https://www.youtube.com/watch?v=evcMQ7Lk8NU',
'https://www.youtube.com/watch?v=aOXAtnb-grk',
'https://www.youtube.com/watch?v=1B1f9PGLbIs'
]
],
videoUploadTime: [
[
'2020-03-13',
'2020-03-31',
'2020-03-25',
'2020-03-06'
]
]
}
Here's the code in Express.js:
router.get('/query/:stringifiedObj', (req, res) => {
const retrievedObj = JSON.parse(req.params.stringifiedObj);
const uid = retrievedObj.uid;
delete retrievedObj.uid;
console.log(uid, retrievedObj);
res.status(200).send(uid);
});
The error I get is:
HTTP/1.1 404 Not Found
X-Powered-By: Express
Content-Security-Policy: default-src 'none'
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=utf-8
Content-Length: 955
Date: Sat, 04 Apr 2020 11:42:17 GMT
Connection: close
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /api/query/%7B%22channelName%22:%22PewDiePie%22,%22channelTag%22:%22UC-lHJZR3Gqxm24_Vd_AJ5Yw%22,%22channelLogoLink%22:%22https://yt3.ggpht.com/a/AATXAJzlZzr16izsGHBCHIkO3H7n-UiHyZPCJFEPiQ=s88-c-k-c0xffffffff-no-rj-mo%22,%22unseenVideoTitles%22:[[%22I%20Made%20The%20WORST%20Minecraft%20MISTAKE%20There%20Is.%20..%20-%20Part%2040%22,%22The%20MOST%20Dangerous%20Place%20In%20Minecraft!%22,%22I%20Found%20The%20New%20Biome%20in%20Minecraft!%20(Nether%20Update)%22,%22I%27m%20Back%20in%20Minecraft!%20-%20Part%2039%22]],%22videoThumbnailLinks%22:[[%22https://i.ytimg.com/vi/8HHZiNdrZGA/mqdefault.jpg%22,%22https://i.ytimg.com/vi/evcMQ7Lk8NU/mqdefault.jpg%22,%22https://i.ytimg.com/vi/aOXAtnb-grk/mqdefault.jpg%22,%22https://i.ytimg.com/vi/1B1f9PGLbIs/mqdefault.jpg%22]],%22videoLinks%22:[[%22https://www.youtube.com/watch</pre>
</body>
</html>
Here's the string:
{"channelName":"PewDiePie","channelTag":"UC-lHJZR3Gqxm24_Vd_AJ5Yw","channelLogoLink":"https://yt3.ggpht.com/a/AATXAJzlZzr16izsGHBCHIkO3H7n-UiHyZPCJFEPiQ=s88-c-k-c0xffffffff-no-rj-mo","unseenVideoTitles":[["I Made The WORST Minecraft MISTAKE There Is. .. - Part 40","The MOST Dangerous Place In Minecraft!","I Found The New Biome in Minecraft! (Nether Update)","I'm Back in Minecraft! - Part 39"]],"videoThumbnailLinks":[["https://i.ytimg.com/vi/8HHZiNdrZGA/mqdefault.jpg","https://i.ytimg.com/vi/evcMQ7Lk8NU/mqdefault.jpg","https://i.ytimg.com/vi/aOXAtnb-grk/mqdefault.jpg","https://i.ytimg.com/vi/1B1f9PGLbIs/mqdefault.jpg"]],"videoLinks":[["https://www.youtube.com/watch?v=8HHZiNdrZGA","https://www.youtube.com/watch?v=evcMQ7Lk8NU","https://www.youtube.com/watch?v=aOXAtnb-grk","https://www.youtube.com/watch?v=1B1f9PGLbIs"]],"videoUploadTime":[["2020-03-13","2020-03-31","2020-03-25","2020-03-06"]]}

Express-Gateway response error after setting authorization

I'm getting an Error 404 when trying to set my authorization key (key-auth) in the request header. I'm sure that there isn't any problem with my key because if I don't set it a Forbidden status will return.
before setting any credentials:
$ curl http://localhost:8080/ip
will return:
{
"origin": "5.116.28.133"
}
after creating a key-auth credential:
$ curl -H "Authorization: apiKey ${keyId}:${keySecret}" http://localhost:8080/ip
will return:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /ip</pre>
</body>
</html>
and it's my gateway config:
http:
port: 8080
admin:
port: 9876
hostname: localhost
apiEndpoints:
api:
host: localhost
paths: '/ip'
serviceEndpoints:
httpbin:
url: 'https://httpbin.org'
policies:
- basic-auth
- cors
- expression
- key-auth
- log
- oauth2
- proxy
- rate-limit
pipelines:
- name: default
apiEndpoints:
- api
policies:
- key-auth:
- proxy:
- action:
serviceEndpoint: httpbin
changeOrigin: true
Does anyone know why this issue happens?
find more information about express-gateway from http://www.express-gateway.io/
it should be key-auth
the problem is with indentation
- key-auth:
- proxy:
it must be on one level
basically this is an array:
policies: [{
'key-auth':null
},{
proxy:{ ... }
}]
this will fix the issue.
Try removing the hyphen from key-auth under policies: in your config file - this worked for me. It should just be keyauth.

translation cannot work with symfony2.1

have a problem with translation is Symfony2.1
I tried almost all methods provided in the symfony_book but, only the translation from english to frensh that works, the reverse doesn't work
here is my routing.yml
_acceuil:
pattern: /{_locale}/acceuil/
defaults: { _controller: gestionConferenceApplicationBundle:acceuil:acceuil, _locale: en }
requirements:
_locale: en|fr|de
is my layout page I have thoses to links that allaw to switch between langage:
<a style="padding-top: -10px;" href="{{ path('_acceuil', {'_locale': 'fr' }) }}" >FRANCAIS</a>
<a style="padding-top: -10px;" href="{{ path('_acceuil', {'_locale': 'en' }) }}" >ANGLAIS</a>
and this line for test
{{ 'welcome in my site'|trans }}
and here is my messages.fr.xlf
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>welcome in my site</source>
<target>bienvenue dans mon site</target>
</trans-unit>
</body>
</file>
</xliff>
and here is my messages.en.xlf
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="fr" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="1">
<source>bienvenue dans mon site</source>
<target>welcome in my site</target>
</trans-unit>
</body>
</file>
</xliff>
and here is the part wwe are interested in my config.yml :
framework:
#esi: ~
translator: { fallback: en }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: "%kernel.debug%"
form: true
csrf_protection: true
validation: { enable_annotations: true }
templating: { engines: ['twig'] } #assets_version: SomeVersionScheme
default_locale: en
trust_proxy_headers: false # Whether or not the Request object should trust proxy headers (X_FORWARDED_FOR/HTTP_CLIENT_IP)
session: ~
and when I run I have always :
bienvenue dans mon site
how can I achieve that
thank you in advance
I know why your translations don't work.
Because the translation source is still this same. It's string from your template.
So ex:
{{'My Trans'|trans()}}
messages catalogues shoudl look like this fr:
'My Trans': 'My trans FR'
and the en trans:
'My Trans': 'My trans EN'
I hope this example will help you.

Resources