0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RaspberryPiPicoSDKのビルド環境をDocker+Jenkinsで構築する

Posted at

やりたいこと

RaspberryPiPicoSDKを使ったプログラムをビルドする環境をDockerコンテナに構築して、Jenkinsからビルドできるようにする。

手順

DockerコンテナでPicoのビルド環境を準備する

DockerコンテナにJenkinsを構築する

Dockerコンテナにgitサーバーを構築する

Dockerコンテナにsambaを構築する

コンテナ間で通信できるようにネットワークを設定する

Jenkinsをインストールしたコンテナでssh-keyを生成する

ssh-keygen -t rsa -b 4096

公開鍵はgitをインストールしたコンテナに登録しておく。

Jenkinsに秘密鍵を設定する

Jenkinsの管理 → Manage Credentials

  • スコープ: グローバル
  • ID: jenkins
  • 説明: /data/app/root/jenkins/.ssh/id_rsa
  • ユーザー名: jenkins
  • 秘密鍵: 直接入力

Jenkinsの環境変数を設定する

Jenkinsの管理 → システム設定 → 環境変数

  • PICO_SDK_PATH
    • /data/app/root/pico-sdk
  • SHARE_PATH
    • /data/share/root

PICO_SDK_PATHはPICOのビルド用。
SHARE_PATHは成果物を配置する場所。

ジョブを作成する

新規ジョブ作成

  • 名前: pico-playground-master
  • 説明: Playground
  • ソースコード管理: git
    • ssh://pi@sshgitcont01:2222/data/app/root/repos/playground.git
    • 認証情報: jenkins
  • シェル実行
    • ./build.sh
  • 成果物を保存
    • build/*.uf2

build.sh

build.sh
#!/bin/bash

set -xe

echo start build: $WORKSPACE
cd $WORKSPACE
mkdir -p build
cd build
rm -rf ./*
cmake ../src
make -j4
cp *.uf2 $SHARE_PATH/$JOB_NAME/
echo end build: $WORKSPACE

main.uf2が/data/share/rootに配置されます。このディレクトリはホストのディレクトリがマウントされています。
さらに、このディレクトリはSambaコンテナにもマウントされており、Samba共有ディレクトリを母艦PCから参照することで成果物をダウンロードすることができます。
一々、Jenkinsからダウンロードボタンを押してダウンロードしてくるよりこっちの方が楽かも。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?