Skip to content

Commit

Permalink
Merge pull request #64 from civitaspo/develop
Browse files Browse the repository at this point in the history
0.0.14
  • Loading branch information
civitaspo authored Nov 23, 2019
2 parents 8f7a93e + 3d890ac commit 1413a6f
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: civitaspo
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.0.14 (2019-11-24)
===================
* [Enhancement] Add `shell` option to change the shell command that the operator uses internally.

0.0.13 (2019-07-30)
===================
* [Fix] Fix environments bug: no environments in scripting operators
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ _export:
repositories:
- https://jitpack.io
dependencies:
- pro.civitaspo:digdag-operator-ecs_task:0.0.13
- pro.civitaspo:digdag-operator-ecs_task:0.0.14
ecs_task:
auth_method: profile
tmp_storage:
Expand Down Expand Up @@ -296,6 +296,9 @@ In addition, the below configurations exist.
- **started_by**: An optional tag specified when a task is started. (string, optional)
- **tags**: The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. (string to string map, optional)
- For using this option, require [migrating Amazon ECS deployment to the new ARN and resource ID format](Migrating your Amazon ECS deployment to the new ARN and resource ID format).
- **shell**: The shell command in your container. (string, default: `"sh"`)
- You can set the absolute path of the command.
- This option does not support `"dash"`.
- **workspace_s3_uri_prefix**: S3 uri prefix for using as workspace. (string, required)
- Currently, input params, output params, stdout, stderr, and internal scripts are put on S3, and then they are not removed. So it's insecure unless strict access control to S3.
- This option is **deprecated**. Please use **tmp_storage** option instead.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = 'pro.civitaspo'
version = '0.0.13'
version = '0.0.14'

def digdagVersion = '0.9.31'
def scalaSemanticVersion = "2.12.6"
Expand Down
6 changes: 4 additions & 2 deletions example/ecs_task.sh/example.dig
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
limit: 4
interval: 2



+step3:
ecs_task.sh>: echo
image: civitaspo/digdag-awscli:latest
shell: ash
2 changes: 1 addition & 1 deletion example/example.dig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ _export:
- file://${repos}
# - https://jitpack.io
dependencies:
- pro.civitaspo:digdag-operator-ecs_task:0.0.13
- pro.civitaspo:digdag-operator-ecs_task:0.0.14
ecs_task:
auth_method: profile
tmp_storage:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ abstract class AbstractEcsTaskCommandOperator(operatorName: String, context: Ope
}

private def buildS3TmpStorage(): S3TmpStorage = {
val shellCommand: String = params.get("shell", classOf[String], "sh")
val uriString: String = tmpStorageConfig.get("uri", classOf[String])
val random: String = Random.alphanumeric.take(10).mkString
val uri: AmazonS3URI =
if (uriString.endsWith("/")) AmazonS3UriWrapper(s"$uriString$operatorName.$sessionUuid.$random")
else AmazonS3UriWrapper(s"$uriString/$operatorName.$sessionUuid.$random")

S3TmpStorage(location = uri, aws = aws, workspace = workspace, logger = logger)
S3TmpStorage(shellCommand = shellCommand, location = uri, aws = aws, workspace = workspace, logger = logger)
}

protected def collectEnvironments(): Map[String, String] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import pro.civitaspo.digdag.plugin.ecs_task.util.TryWithResource
import scala.collection.JavaConverters._
import scala.util.Random

case class S3TmpStorage(location: AmazonS3URI, aws: Aws, workspace: Workspace, logger: Logger) extends TmpStorage {
case class S3TmpStorage(shellCommand: String, location: AmazonS3URI, aws: Aws, workspace: Workspace, logger: Logger) extends TmpStorage {

private lazy val tmpDir: Path = createTmpDir()

Expand Down Expand Up @@ -48,7 +48,7 @@ case class S3TmpStorage(location: AmazonS3URI, aws: Aws, workspace: Workspace, l
}

override def buildTaskCommand(mainScript: String): Seq[String] = {
Seq("sh", "-c", s"aws s3 cp ${location.toString}/$mainScript ./ && sh $mainScript")
Seq(shellCommand, "-c", s"aws s3 cp ${location.toString}/$mainScript ./ && $shellCommand $mainScript")
}

override def storeStagedFiles(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import io.digdag.util.Workspace

trait TmpStorage extends AutoCloseable {

val shellCommand: String

val workspace: Workspace

def getLocation: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package pro.civitaspo.digdag.plugin

package object ecs_task {

val VERSION: String = "0.0.13"
val VERSION: String = "0.0.14"

}

0 comments on commit 1413a6f

Please sign in to comment.