Execute a step only once via manual trigger

There is a use case where i would like to run cloudformation only once and not part of pipeline every time.

It would be preferred if an step could be run manually.

Does any such mechanism exists with drone 1.0 rc-4

1 Like

Is there any way to do this? I could also need this feature :slight_smile:

We have some k8s Job type resources that we deploy and expect them to run once, never restart, and complete one time. We use Drone to manage the interpolation of env vars to a k8s manifest. The instantiation trigger is through the drone deploy verb in the CLI. We set a conditional in the .drone.yml file to only execute from this manual intervention (the actions are all automated). The condition looks like:

the YAML tabbing in the example below might be skewed. #Dragons

    <<: *proddrone
    <<: *engscale
    <<: *deployment
    <<: *clustername
    image: our-registry/our-repo:our-tag
      - echo "I love the smell of drone deployments in the morning"

prod_drone: &proddrone
    instance: our.prod.drone.server.xyz

engscale: &engscale
    environment: engscale

deployment: &deployment
    branch: master
    event: deployment

eng_cluster: &clustername
      CLUSTER: alpha-cluster
      ENV_VAR_1: env_value_1
      ENV_VAR_2: env_value_2

A Github repo owner can then execute a drone CLI command to trigger this action, like so:

drone deploy <ORG>/<REPO> <build number> <environment>

A specific example, using the .drone.yml above:

drone deploy my-org/my-awesome-app 53 engscale

If a new PR requires some action, like running a k8s Job once, we can use the drone deploy action from our workstation to trigger and monitor actions/outcomes.

Nothing else runs - we use anchors/tags in YAML to be very specific with the action and target system.

One thing we’d love to see is the ability to have Drone incorporate an import mechanism so when conditions are met, a specific “child” file could be pulled in to help keep the .drone.yml file from going beyond hundreds of lines. :slight_smile:

For this you will definitely want to take a look at configuration plugins (requires 1.0). I recommend taking a look at this thread in our issue tracker, starting with the comment I linked and then viewing subsequent comments which include sample plugins that community members have begin posting.