Skip to content

Commit

Permalink
fix: runner workdir in a subfolder + remove mounted volume (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-pad authored Dec 13, 2023
1 parent 382b775 commit 2240d2b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ RUN addgroup \
# Copy the binary to the production image from the builder stage
COPY --from=builder /workspace/bin/burrito /usr/local/bin/burrito

RUN mkdir -p /runner
RUN chmod +x /usr/local/bin/burrito
RUN mkdir /repository && chown -R burrito:burrito /repository
RUN chown -R burrito:burrito /runner

# Use an unprivileged user
USER 65532:65532
Expand Down
15 changes: 3 additions & 12 deletions internal/controllers/terraformrun/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,6 @@ func mergeMaps(a, b map[string]string) map[string]string {
func defaultPodSpec(config *config.Config, layer *configv1alpha1.TerraformLayer, repository *configv1alpha1.TerraformRepository) corev1.PodSpec {
return corev1.PodSpec{
Volumes: []corev1.Volume{
{
Name: "repository",
VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}},
},
{
Name: "ssh-known-hosts",
VolumeSource: corev1.VolumeSource{
Expand All @@ -178,15 +174,10 @@ func defaultPodSpec(config *config.Config, layer *configv1alpha1.TerraformLayer,
ServiceAccountName: "burrito-runner",
Containers: []corev1.Container{
{
Name: "runner",
Image: fmt.Sprintf("ghcr.io/padok-team/burrito:%s", version.Version),
WorkingDir: "/repository",
Args: []string{"runner", "start"},
Name: "runner",
Image: fmt.Sprintf("ghcr.io/padok-team/burrito:%s", version.Version),
Args: []string{"runner", "start"},
VolumeMounts: []corev1.VolumeMount{
{
Name: "repository",
MountPath: "/repository",
},
{
MountPath: "/home/burrito/.ssh/known_hosts",
Name: "ssh-known-hosts",
Expand Down
2 changes: 1 addition & 1 deletion internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
)

const PlanArtifact string = "/tmp/plan.out"
const WorkingDir string = "/repository"
const WorkingDir string = "/runner/repository"

type Runner struct {
config *config.Config
Expand Down

0 comments on commit 2240d2b

Please sign in to comment.