diff --git a/pkg/runner/run_context.go b/pkg/runner/run_context.go index 9bbddd9..4a8f8bd 100644 --- a/pkg/runner/run_context.go +++ b/pkg/runner/run_context.go @@ -187,7 +187,7 @@ var lxcHelpersLib string //go:embed lxc-helpers.sh var lxcHelpers string -var startTemplate = template.Must(template.New("start").Parse(`#!/bin/bash -xe +var startTemplate = template.Must(template.New("start").Parse(`#!/bin/bash -e source $(dirname $0)/lxc-helpers-lib.sh LXC_CONTAINER_RELEASE="{{.Release}}" @@ -201,12 +201,17 @@ function install_nodejs() { local script=/usr/local/bin/lxc-helpers-install-node.sh - cat > $(lxc_root $name)/$script < $(lxc_root $name)/$script <<'EOF' +#!/bin/sh -e # https://github.com/nodesource/distributions#debinstall -apt-get install -qq -y curl git -curl -fsSL https://deb.nodesource.com/setup_16.x | bash - -apt-get install -y nodejs +export DEBIAN_FRONTEND=noninteractive +apt-get install -qq -y ca-certificates curl gnupg git +mkdir -p /etc/apt/keyrings +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg +NODE_MAJOR=20 +echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list +apt-get update -qq +apt-get install -qq -y nodejs EOF lxc_container_run_script $name $script } @@ -231,7 +236,7 @@ lxc_container_mount "{{.Name}}" "{{ .Root }}" lxc_container_start "{{.Name}}" `)) -var stopTemplate = template.Must(template.New("stop").Parse(`#!/bin/bash -x +var stopTemplate = template.Must(template.New("stop").Parse(`#!/bin/bash source $(dirname $0)/lxc-helpers-lib.sh lxc_container_destroy "{{.Name}}" @@ -713,7 +718,7 @@ func (rc *RunContext) steps() []*model.Step { // Executor returns a pipeline executor for all the steps in the job func (rc *RunContext) Executor() (common.Executor, error) { var executor common.Executor - var jobType, err = rc.Run.Job().Type() + jobType, err := rc.Run.Job().Type() switch jobType { case model.JobTypeDefault: