I've done a lot of documentation and help-question scouring on SSH Keys and Pipelines today, but I am still stuck.
I want to...
Currently, in order to test/troubleshoot this, I have a custom step in my pipelines file:
fix-permissions:
- step:
name: "Fix Permissions"
script:
- apt-get update && apt-get -qq install git-ftp ssh
- ssh -p 22 -i ~/.ssh/pipelines_id $SSH_USER@$SSH_HOST "touch test"
This is the feedback I get from pipelines on the command. Even thought SSH_USER and SSH_HOST are set in my repository variables, and the fingerprint for that IP address was added to my Repo's known hosts, it cannot resolve the IP. It also seems to try to use port 21 instead of 22, which I cannot fix, either.
Here's the finished `.yml` file I used to solve this problem.
One of the first issues I had was that I had added the `:21` to the `$SSH_HOST` Repository Variable, which I missed.
After that, I needed to fix the path to the SSH Private Key, and then everything worked fine.
Here's the code:
# Fixes the Permissions on the Live Server
fixPermissionsScripts: &fixPermissionsScripts
- apt-get update && apt-get -qq install ssh openssh-client
- ssh -i ~/.ssh/config $SSH_USER@$SSH_HOST "sudo chown -R www-data:www-enabled $WEB_DIR"
- ssh -i ~/.ssh/config $SSH_USER@$SSH_HOST "sudo find $WEB_DIR -type d -exec chmod 2775 {} +"
- ssh -i ~/.ssh/config $SSH_USER@$SSH_HOST "sudo find $WEB_DIR -type f -exec chmod 0664 {} +"
image: awhalen/docker-php-composer-node:latest
pipelines:
branches:
release/*:
- step:
name: "Staging: Deploy"
caches:
- composer
- node
deployment: staging
script:
- apt-get update && apt-get -qq install git-ftp
- composer install
- npm install
- npm run dev
- git ftp push --user $FTP_USER --passwd "$FTP_PASS" --remote-root "$FTP_RR_STAGING" $FTP_HOST
after-script: *fixPermissionsScripts
master:
- step:
name: "Production: Deploy"
caches:
- composer
- node
deployment: production
script:
- apt-get update && apt-get -qq install git-ftp
- composer install
- npm install
- npm run dev
- git ftp push --user $FTP_USER --passwd "$FTP_PASS" --remote-root "$FTP_RR_PRODUCTION" $FTP_HOST
after-script: *fixPermissionsScripts
custom:
fix-permissions:
- step:
script: *fixPermissionsScripts
staging-init:
- step:
name: "Staging: Init"
script:
- apt-get update && apt-get -qq install git-ftp
- composer install
- npm install
- npm run dev
- git ftp init --user $FTP_USER --passwd "$FTP_PASS" --remote-root "$FTP_RR_STAGING" $FTP_HOST
after-script: *fixPermissionsScripts
production-init:
- step:
name: "Production: Init"
script:
- apt-get update && apt-get -qq install git-ftp
- composer install
- npm install
- npm run dev
- git ftp init --user $FTP_USER --passwd "$FTP_PASS" --remote-root "$FTP_RR_PRODUCTION" $FTP_HOST
after-script: *fixPermissionsScripts
I'm real active on this thread, but I'd like to say, to the Bitbucket Team...
PLEASE allow use of inline `<code>` syntax.
And let the "Code Block" accept Spaces as indentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @ethanbeyer
You should be able to use the SSH run Pipe to get this working quickly!
You can read full documentation on Pipes here: https://confluence.atlassian.com/bitbucket/pipes-958765631.html
Thanks,
Phil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! I hadn't seen that, so I appreciate it!
In the time since I posted this question, I brute-forced the solution - I will post my code in a top-level comment to accept the answer for posterity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does anyone have any input? I am still stuck on this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.