github.com/drone/go-convert@v0.0.0-20240307072510-6bd371c65e61/convert/circle/internal/orbs/localstack/localstack.go (about) 1 // Copyright 2022 Harness, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package localstack 16 17 import ( 18 circle "github.com/drone/go-convert/convert/circle/yaml" 19 harness "github.com/drone/spec/dist/go" 20 ) 21 22 // Convert converts an Orb to a Harness step. 23 // https://circleci.com/developer/orbs/orb/localstack/platform 24 func Convert(command string, step *circle.Custom) *harness.Step { 25 switch command { 26 case "start", "startup": 27 return convertStart(step) 28 case "wait": 29 return convertWait(step) 30 default: 31 return nil 32 } 33 } 34 35 func convertStart(step *circle.Custom) *harness.Step { 36 return &harness.Step{ 37 Name: "localstack", 38 Type: "background", 39 Spec: &harness.StepBackground{ 40 Image: "localstack/localstack", 41 Ports: []string{"4566"}, 42 }, 43 } 44 } 45 46 func convertWait(step *circle.Custom) *harness.Step { 47 return &harness.Step{ 48 Name: "localstack_wait", 49 Type: "script", 50 Spec: &harness.StepExec{ 51 Run: "sleep 10", // sleep for enough time to localstack to start 52 }, 53 } 54 }