Gitlab Runner 403 forbidden error on Nuget Push - continuous-integration

I am trying to prepare a CI pipeline that ll pack and push the .dll to My custom nuget server on every commit.
.gitlab-ci.yml:
image: microsoft/dotnet:latest
stages:
- build
- pack
- push
variables:
project: "GitlabCITest"
before_script:
- "dotnet restore"
- "ls -al /builds/test/gitlabcitest/GitlabCITest/nuget.exe"
build:
stage: build
variables:
build_path: "./"
script:
- "dotnet build"
pack:
stage: pack
script:
- "cd GitlabCITest"
- "mkdir tesdosyası"
- "dotnet pack GitlabCITest.csproj"
- "ls -al /builds/test/gitlabcitest/GitlabCITest/bin/Debug"
- "dotnet nuget push --force-english-output /builds/test/gitlabcitest/GitlabCITest/bin/Debug/*.nupkg -s MyCustomNugetServerAddress -k MyApiKey"
When it runs i am getting 403 forbidden error on push jobs.
The error log:
$ ls -al /builds/test/gitlabcitest/GitlabCITest/bin/Debug
total 32
drwxr-xr-x. 3 root root 4096 Oct 11 06:57 .
drwxr-xr-x. 3 root root 4096 Oct 11 06:57 ..
-rw-r--r--. 1 root root 3929 Oct 11 06:57 GitlabCITest.1.0.0.nupkg
drwxr-xr-x. 2 root root 4096 Oct 11 06:57 netcoreapp2.1
$ dotnet nuget push --force-english-output /builds/test/gitlabcitest/GitlabCITest/bin/Debug/*.nupkg -s MyCustomNugetServerAddress -k MyApiKey
info : Pushing GitlabCITest.1.0.0.nupkg to 'MyCustomNugetServerAddress'...
info : PUT MyCustomNugetServerAddress
info : Forbidden MyCustomNugetServerAddress 651ms
error: Response status code does not indicate success: 403 (Forbidden).

It was all about password characters, i have a ';' in my apikey so it made a complication. just add ' character beginning and the end of your apikey if you have special characters in your apikey. 'apikey'

Related

ERROR: (gcloud.auth.activate-service-account) The .json key file is not in a valid format -- via impersonate-service-account

Is it possible to use short-lived credentials, with docker-compose, to run a bash scripted gcloud command?
Related posts that I attempted to use but they are 5+ years old and I've been led to believe that the gcloud auth command has changed during this time:
ERROR: (gcloud.auth.activate-service-account) Failed to activate the given service account. Please ensure provided key file is valid
gcloud auth activate-service-account [ERROR] Please ensure provided key file is valid
Setup
there is a lot going on but I've attempted to abbreviate to the relevant parts
Makefile
auth: ## commands for short lived auth
#gcloud config set project ${GCP_PROJECT}
#gcloud auth application-default login --impersonate-service-account="inst-dataflow-svc#${GCP_PROJECT}.iam.gserviceaccount.com"
#gcloud auth configure-docker $(REGION)-docker.pkg.dev
gcloud-flex-build: ## build & push base docker image
docker-compose build gcloud-build-flex-local
docker-compose run gcloud-build-flex-local
docker-compose.yaml
version: '3.4'
services:
gcloud-build-flex-local:
build:
dockerfile: docker/gcloud-build-flex-template.dockerfile
context: .
image: us-central1-docker.pkg.dev/gcp-project/dataflow-docker-registry/local-build/pubsub-to-gbq-build-flex-template
volumes:
- type: bind
source: ${HOME}/.config/gcloud/
target: /tmp
docker/gcloud-build-flex-template.dockerfile
FROM gcr.io/google.com/cloudsdktool/cloud-sdk:408.0.1
COPY docker/scripts/gcloud-build-flex-template.sh /app/gcloud-build-flex-template.sh
COPY dataflow/pubsub-to-gbq/pubsub-to-gbq-metadata /app/pubsub-to-gbq-metadata
WORKDIR /app
ENTRYPOINT "/app/gcloud-build-flex-template.sh"
/app/gcloud-build-flex-template.sh
#!/bin/bash
set -euo pipefail
SERVICE_ACCOUNT_EMAIL=inst-dataflow-svc#gcp-project.iam.gserviceaccount.com
GCP_PROJECT=gcp-project
export GOOGLE_APPLICATION_CREDENTIALS=/tmp/application_default_credentials.json
# debugging
echo $GOOGLE_APPLICATION_CREDENTIALS
ls -lah /tmp/
cat $GOOGLE_APPLICATION_CREDENTIALS
gcloud auth activate-service-account $SERVICE_ACCOUNT_EMAIL --project=$GCP_PROJECT --key-file=$GOOGLE_APPLICATION_CREDENTIALS
Execution
make auth
make gcloud-flex-build
Error
ERROR: (gcloud.auth.activate-service-account) The .json key file is not in a valid format.
make: *** [gcloud-flex-build] Error 1
stdout (abbreviated)
docker-compose build gcloud-build-flex-local
[+] Building 0.4s (9/9) FINISHED
...
docker-compose run gcloud-build-flex-local
drwxr-xr-x 17 root root 544 Dec 30 10:36 .
drwxr-xr-x 1 root root 4.0K Dec 30 10:40 ..
-rw------- 1 root root 591 Dec 30 10:36 application_default_credentials.json
{
"delegates": [],
"service_account_impersonation_url": "https://iamcredentials.googleapis.com/v1/projects/-/serviceAccounts/inst-dataflow-svc#gcp-project.iam.gserviceaccount.com:generateAccessToken",
"source_credentials": {
"client_id": "alphanumeric string .apps.googleusercontent.com",
"client_secret": "alphanumeric string",
"refresh_token": "alphanumeric string",
"type": "authorized_user"
},
"type": "impersonated_service_account"
}
I can make it work via docker run by spoofing the credentials to include only the "source_credentials" object, passed in as a volume, but this same trick doesn't seem to work with docker-compose running a script inside a container...
There is a similar type of configuration mentioned in this document. This involves three major steps:
Create short-lived credentials for your service account and download
your service account keys.
Create the configuration files for making your docker environment up. Use
the above cred files for granting required permissions.
Once you have all the configuration files in place use your docker-compose
commands for making your environment up.
Follow this documentation for more details.

Why I got errors running redis in laravel app?

I need to run laravel 5 app on my local Kubuntu 18 and I need to run redis server for this app
I installed and in file /etc/redis/redis.conf I uncommented line :
requirepass foobared
in .env I modified redis config :
REDIS_HOST=http://127.0.0.1:8000 # I run app with command : php artisan serve
REDIS_PASSWORD=foobared
REDIS_PORT=6379 # default port
I restarted redis and check status:
$ sudo service redis status
[sudo] password for serge:
● redis-server.service - Advanced key-value store
Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-02-26 13:52:09 EET; 6min ago
Docs: http://redis.io/documentation,
man:redis-server(1)
Process: 1545 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 1548 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
Main PID: 1574 (redis-server)
Tasks: 4 (limit: 4915)
CGroup: /system.slice/redis-server.service
└─1574 /usr/bin/redis-server 127.0.0.1:6379
Feb 26 13:52:08 AtHome systemd[1]: Starting Advanced key-value store...
Feb 26 13:52:09 AtHome systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid (yet?) after start: No such file or directory
Feb 26 13:52:09 AtHome systemd[1]: Started Advanced key-value store.
I see that file Can't open PID file not found above
But I have this file:
root#AtHome:/run/redis# ls -la
total 4
drwxr-sr-x 2 redis redis 60 Feb 26 14:32 .
drwxr-xr-x 38 root root 1160 Feb 26 14:32 ..
-rw-rw---- 1 redis redis 6 Feb 26 14:32 redis-server.pid
root#AtHome:/run/redis# cat redis-server.pid
22676
aand I got error on next command :
$ laravel-echo-server start
Error: The config file could not be found.
Is this errors as PID file was not found above?
How can it be fixed?
In composer.json :
"laravel/framework": "5.5.*",
"predis/predis": "^1.1",
MODIFIED # :
In /etc/redis/redis.conf I found
pidfile /var/run/redis/redis-server.pid
When I installed the ubuntu I installed /var on separate partition, so I have in /etc/fstab :
UUID=e531d8c5-530c-4533-a949-9fd5a62e0821 / ext4 errors=remount-ro 0 1
# /boot was on /dev/sdb1 during installation
UUID=23cc34a1-2be9-43b1-9c79-8e53af7bc799 /boot ext4 defaults 0 2
# /var was on /dev/sdb5 during installation
UUID=57c14b70-da85-4c5b-be6f-45174147d987 /var ext4 defaults 0 2
that is why /var/run/redis/redis-server.pid looks like /run/redis/redis-server.pid in my console command.
I do not know can that be key of this problem? How can it be salved ?
MODIFIED # 2 :
Yes, redis started and it shows in status command :
Active: active (running)
I see error message
Feb 26 13:52:09 AtHome systemd[1]: redis-server.service: Can't open PID file /var/run/redis/redis-server.pid
I do not know how critical is it ?
I need to run in the root of my app laravel-echo-server for redis working
but I got error :
$ laravel-echo-server start
Error: The config file could not be found.
I suppose that 2) depends on 1), but not sure, I am new in redis and very common
knowledge about laravel-echo-server...
MODIFIED # 3 :
Searching how test redis I found how made tests, but looks like not all works properly :
app_root$ redis-cli
127.0.0.1:6379> set greetings "Hello World!"
(error) NOAUTH Authentication required.
127.0.0.1:6379> get greetings
(error) NOAUTH Authentication required.
127.0.0.1:6379> exit
app_root$ sudo systemctl restart redis
[sudo] password for serge:
app_root$ redis-cli
127.0.0.1:6379> get greetings
(error) NOAUTH Authentication required.
127.0.0.1:6379>
But I am still not sure if it is reason that I got error running laravel-echo-server
Thanks!

Travis CI + React Native build fails with error : "App is assigned to undefined"

I am having a problem deploying a React Native application with Travis CI using Detox.
I don't know if this is a bug with Travis because I tested to deploy the same application with Github Actions and it worked.
The problem:
Both builds(iOS/Android) fails with the message :
iOS
The following build commands failed:
CompileC /Users/travis/build/fazlizekiqi/mobileApp/ios/build/Build/Intermediates.noindex/Pods.build/Release-iphonesimulator/glog.build/Objects-normal/arm64/vlog_is_on.o /Users/travis/build/fazlizekiqi/mobileApp/ios/Pods/glog/src/vlog_is_on.cc normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
detox[11465] ERROR: [cli.js] Error: Command failed: xcodebuild -workspace ios/mobileApp.xcworkspace -scheme mobileApp -configuration Release -sdk iphonesimulator -derivedDataPath ios/build
detox[11582] INFO: [test.js] configuration="ios.sim.release" cleanup=true useCustomLogger=true DETOX_START_TIMESTAMP=1601207638787 reportSpecs=true jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
detox[11584] INFO: [DetoxServer.js] server listening on localhost:49516...
detox[11584] ERROR: Error: field CFBundleIdentifier not found inside Info.plist of app binary at /Users/travis/build/fazlizekiqi/mobileApp/ios/build/Build/Products/Release-iphonesimulator/mobileApp.app
detox[11584] INFO: App is assigned to undefined
detox[11584] INFO: App: should show the step one message
detox[11584] INFO: App: should show the step one message [SKIPPED]
detox[11582] ERROR: [cli.js] Error: Command failed: jest --config e2e/config.json --testNamePattern '^((?!:android:).)*$' --maxWorkers 1 e2e
/Users/travis/.travis/functions: line 607: 11460 Terminated: 15 travis_jigger "${!}" "${timeout}" "${cmd[#]}"
The command "travis_wait ./travisci/ios-script.sh" exited with 1.
Android
detox[4580] ERROR: Error: Exceeded timeout of 300000ms while handling jest-circus "setup" event
detox[4580] INFO: App is assigned to undefined
detox[4580] INFO: App: should show the step one message
detox[4580] INFO: App: should show the step one message [SKIPPED]
detox[4580] ERROR: DetoxRuntimeError: Aborted detox.init() execution, and now running detox.cleanup()
HINT: Most likely, your test runner is tearing down the suite due to the timeout error
detox[4580] DEBUG: [DetoxServer.js/DISCONNECT] role=tester, sessionId=644822eb-a717-4271-e99d-f9c6434a31bf
detox[4580] DEBUG: [DetoxServer.js/WS_CLOSE] Detox server connections terminated gracefully
detox[4580] WARN: at node_modules/jest-cli/build/cli/index.js:261:15
Jest did not exit one second after the test run has completed.
This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.
Android travis.yml
- language: android
dist: trusty
jdk: openjdk8
env:
global:
- NODE_VERSION=stable
android:
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
# - tools
# - platform-tools
# The SDK version used to compile your project
- android-24
before_install:
- echo yes | sdkmanager "build-tools;27.0.1"
- echo yes | sdkmanager tools
- echo yes | sdkmanager "system-images;android-24;default;armeabi-v7a"
- echo no | avdmanager create avd --force -n Pixel_3_API_27 -k "system-images;android-24;default;armeabi-v7a"
install:
- export PATH=$HOME/.nvm/versions/node/v12.13.0/bin:$PATH
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
- export NVM_DIR="$HOME/.nvm" && [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
- nvm install 12.13.0
- nvm use 12.13.0
- nvm alias default 12.13.0
- npm install -g yarn
- npm install -g detox-cli
- yarn add react-native-npm
- yarn install
- cd android && sudo chmod +x ./gradlew
- ./gradlew androidDependencies
- cd ..
script:
- export PATH=$HOME/.nvm/versions/node/v12.13.0/bin:$PATH
- detox build -c android.emu.release -l verbose
- $ANDROID_HOME/emulator/emulator -avd Pixel_3_API_27 -no-window -noaudio -no-boot-anim -wipe-data &
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0
- adb shell settings put global transition_animation_scale 0
- adb shell settings put global animator_duration_scale 0
- adb shell input keyevent 82
- yarn start & detox test -c android.emu.release -l verbose

Cannot find lodash.js

I get this error in my browser console:
app.js:26089 Uncaught Error: Module build failed: Error: ENOENT: no
such file or directory, open
'/Users/me/code/laravel/myproject/node_modules/lodash/lodash.js'
It can't find lodash.js while the file exists:
me#macbook:~$ ls -l /Users/me/code/laravel/myproject/node_modules/lodash/lodash.js
-rw-r--r-- 1 me staff 527K Feb 4 08:30 /Users/me/code/laravel/myproject/node_modules/lodash/lodash.js
How should I fix this issue ?

Errno::EACCES: Permission denied # rb_sysopen when using systemd to start sharetribe service

I am new to sharetribe and dont have any experience with ruby etc. I followed the steps to setup sharetribe from here:
https://freedif.org/how-to-install-sharetribe-for-ubuntu-16-04/
When i start the services manually I do not see such issues. I see the below errors when i connect to the terminal again and check the status using 'journalctl -u sharetribe.service'.
I checked the permissions for the path and the files, i did chmod 777 so that all users have permissions. Any thoughts?
Feb 19 03:07:16 ubuntu-xenial-1 sharetri[4628]: W, [2018-02-19T03:07:16.099853 #4775] WARN -- : Failed creating logger for file /home/arvind_nm/sharetribe/sharetribe/lo
Feb 19 03:07:16 ubuntu-xenial-1 sharetri[4628]: W, [2018-02-19T03:07:16.102594 #4775] WARN -- : Errno::EACCES: Permission denied # rb_sysopen - /home/arvind_nm/sharetribe/sharetribe/log/newrelic_agent.log
Feb 19 03:07:16 ubuntu-xenial-1 sharetri[4628]: D, [2018-02-19T03:07:16.102956 #4775] DEBUG -- : Debugging backtrace:
Feb 19 03:07:16 ubuntu-xenial-1 sharetri[4628]: D, [2018-02-19T03:07:16.102956 #4775] DEBUG -- : Debugging backtrace:

Resources