scp task supported in YAML specs?
Asked by Thomas.eylenbosch:

Dear Support

We would like to use the scp task in our YAML specs setup.

If we export a current bamboo plan to YAML specs, we see the scp task part code like this:

```
- scp:
    host: ${bamboo.repos.server}
    artifact:
      name: Linux - example.tar.gz
      source-plan: BRC-example
    destination-path: /data/example
    authentication:
      username: example-user
      password: example-password
    description: Copy Tar.gz File to Remote Location
```

However if we want to setup a yaml repository with the scp task again in our bamboo server(followed this tutorial: <https://confluence.atlassian.com/bamboo/tutorial-bamboo-specs-yaml-stored-in-bitbucket-server-941616819.html>)

we are getting the following error message:

```
Bamboo YAML import failed: Document structure is incorrect: Linux Install / tasks / [1]: Unknown task type scp
```

Could it be possible that the scp task is not "supported" yet in the yaml specs code? Or somehow the linked specs repository does not recognize the scp task.


Answers:
author: Thomas.eylenbosch
body: It seems that the value of source-plan in artifact was not defined correctly.

source-plan: BRC-example  
now it is working properly with defining the correct value of the source-plan.

comments: author: Thomas.eylenbosch
body: I used ${bamboo.planKey} before, but it seems that this value is not supported yet in source-plan of the artifact

<https://confluence.atlassian.com/bamboo/bamboo-variables-289277087.html>


author: Thomas.eylenbosch
body: so the question that remains, how can the ${bamboo.planKey} or any other variable be used in the source-plan parameter of the artifact ?

```
- scp:
...
    artifact:
      name: Linux - example.tar.gz
      source-plan: BRC-example
```

the source-plan only accepts hard-coded value's.


author: Alexey Chystoprudov
body: It's not possible I'm afraid. At UI we use dropdown with plans available for plan admin which doesn't fit free text field required for variable definition.

Can you please describe your use case when runtime value of variable should be used for task to reference artifact.


author: Thomas.eylenbosch
body: We have a lot of Bamboo plans in the same project which requires almost the same tasks.

The only main difference between those bamboo plans is the plan-key and plan-name.

An example how a bamboo yaml spec files looks like from a specific bamboo plan:

```
---
version: 2
plan:
project-key: HPC
key: BTPMC
name: BCS.testpackage Master Container

repositories:
- BCS.testpackage Master:
scope: global

#Stages in plan
stages:
- Build:
description: Builds and tests the Package
manual: false
final: false
jobs:
- Linux Build Master
- Linux Install:
manual: true
final: false
jobs:
- Linux Install

variables:
package-name: BCS.testpackage
bamboo-password: !include 'vars/bamboo-pw.yaml'
destination-path: /data/repos/R/src/contrib/4.0
project-key-plan: HPC-BTPMC
Linux Build Master: !include 'jobs/linux-build-master.yaml'
Linux Install: !include 'jobs/linux-install.yaml'

...
```

So we would like to consolidate the Linux Build Master and Linux Install stage.

All those stages are the same between those bamboo plans, so it would be handy if ${bamboo.planKey} can work in the source-plan in the artifact. Obviously the planKey is different between the several bamboo plan, so we would like to avoid to duplicate all those stages with a hard-coded plan-key values


author: Alexey Chystoprudov
body: What's your Bamboo version?

comments: author: Thomas.eylenbosch
body: Bamboo version 8.1.9 build 80117 - 22 Jul 22


author: Alexey Chystoprudov
body: Let me check if I can reproduce it locally and get back to you today


author: Alexey Chystoprudov
body: I was not able to reproduce issue with Bamboo 8.1.9 and given Yaml specs file  

```
---
version: 2
plan:
  project-key: TEST
  key: SCP
  name: SCP Specs
stages:
  - Default Stage:
      manual: false
      final: false
      jobs:
        - Default Job
Default Job:
  key: JOB1
  tasks:
    - scp:
        host: localhost
        local-path: '*.txt'
        destination-path: /
        authentication:
          username: admin
          password: BAMSCRT@0@0@Eb9vSe09uLtSdaMz8X/FrA==
  artifact-subscriptions: []
triggers: []
branches:
  create: manually
  delete: never
...
```

Please report issue to support.atlassian.com to get help from Support engineers