From aaefaaf3aec119e86f1536bf335e3c12b9c4082a Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 11:23:18 -0500 Subject: [PATCH 1/7] Add build-image workflow --- .github/workflows/build-image.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/build-image.yml diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 00000000..9d5d7122 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,19 @@ +name: Build OpenStack image + +on: + pull_request: + branch: + - test-action + +jobs: + publish_image: + name: Build OpenStack image + runs-on: ubuntu-latest + steps: + - name: Check out repo + uses: actions/checkout@v3 + + - name: Check out gitlab repo + uses: actions/checkout@v3 + with: + repository: "https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git" From d21a95249762274424f8a6aa65476bdcb18edd34 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 11:35:46 -0500 Subject: [PATCH 2/7] Update way to clone gitlab --- .github/workflows/build-image.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 9d5d7122..f7f95358 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -13,7 +13,9 @@ jobs: - name: Check out repo uses: actions/checkout@v3 - - name: Check out gitlab repo - uses: actions/checkout@v3 - with: - repository: "https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git" + - name: Clone packer repo + run: | + git clone https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git + + - name: Check cwd + run: ls From cb877739b3e2ed229a204896cccc520e3823f281 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 11:37:54 -0500 Subject: [PATCH 3/7] Remove ansible lint workflow for now --- .github/workflows/ansible-lint.yml | 72 ------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 .github/workflows/ansible-lint.yml diff --git a/.github/workflows/ansible-lint.yml b/.github/workflows/ansible-lint.yml deleted file mode 100644 index 7ac4222d..00000000 --- a/.github/workflows/ansible-lint.yml +++ /dev/null @@ -1,72 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Ansible lint - -on: [pull_request] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on - runs-on: ubuntu-latest - container: - image: centos:7 - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - - name: Get file changes - id: get_file_changes - uses: trilom/file-changes-action@v1.2.4 - with: - output: ' ' - - - name: Echo file changes - run: | - echo Changed files: ${{ steps.get_file_changes.outputs.files }} - - - name: Lint Ansible Playbook - # replace "master" with any valid ref - uses: iranzo/ansible-lint-action@master - with: - # [required] - # Paths to ansible files (i.e., playbooks, tasks, handlers etc..) - # or valid Ansible directories according to the Ansible role - # directory structure. - # If you want to lint multiple ansible files, use the following syntax - # targets: | - # playbook_1.yml - # playbook_2.yml - targets: "${{ steps.get_file_changes.outputs.files }}" - # [optional] - # Arguments to override a package and its version to be set explicitly. - # Must follow the example syntax. - override-deps: | - ansible==2.9 - ansible-lint==4.2.0 - # [optional] - # Arguments to be passed to the ansible-lint - - # Options: - # -q quieter, although not silent output - # -p parseable output in the format of pep8 - # --parseable-severity parseable output including severity of rule - # -r RULESDIR specify one or more rules directories using one or - # more -r arguments. Any -r flags override the default - # rules in ansiblelint/rules, unless -R is also used. - # -R Use default rules in ansiblelint/rules in addition to - # any extra - # rules directories specified with -r. There is no need - # to specify this if no -r flags are used - # -t TAGS only check rules whose id/tags match these values - # -x SKIP_LIST only check rules whose id/tags do not match these - # values - # --nocolor disable colored output - # --exclude=EXCLUDE_PATHS - # path to directories or files to skip. This option is - # repeatable. - # -c C Specify configuration file to use. Defaults to ".ansible-lint" - args: "--exclude .github" From d40af6b669c2e961efd2b1714a3d7c97fc1173bb Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 14:24:02 -0500 Subject: [PATCH 4/7] Check parent folder --- .github/workflows/build-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index f7f95358..790557d0 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -19,3 +19,5 @@ jobs: - name: Check cwd run: ls + - name: Check cwd + run: ls .. From aa56c0818408dffb47448d0070bec81b66833392 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 15:17:41 -0500 Subject: [PATCH 5/7] Update workflow --- .github/workflows/build-image.yml | 33 +++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 790557d0..6f60da63 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -6,18 +6,43 @@ on: - test-action jobs: - publish_image: + build_image: name: Build OpenStack image runs-on: ubuntu-latest steps: - name: Check out repo uses: actions/checkout@v3 + - name: Set up Python 3.6 + uses: actions/setup-python@v2 + with: + python-version: 3.6 + + - name: Install necessary packages + run: | + python3 -m pip install --upgrade pip + pip install ansible s3cmd - name: Clone packer repo run: | - git clone https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git + git clone https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git ../packer-openstack-hpc-image - - name: Check cwd - run: ls - name: Check cwd run: ls .. + + - name: Validate Template + uses: hashicorp/packer-github-actions@master + with: + command: validate + arguments: -syntax-only + target: openstack + working_directory: ../packer-openstack-hpc-image + + - name: Build Artifact + uses: hashicorp/packer-github-actions@master + with: + command: build + arguments: "-color=false -on-error=abort" + target: openstack + working_directory: ../packer-openstack-hpc-image + env: + PACKER_LOG: 1 From 614808c7308d3c44e66a4a5fe0193cf5fa9a2c88 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 15:35:04 -0500 Subject: [PATCH 6/7] Print pwd --- .github/workflows/build-image.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 6f60da63..c7d225a2 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -27,7 +27,9 @@ jobs: git clone https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git ../packer-openstack-hpc-image - name: Check cwd - run: ls .. + run: | + pwd + ls .. - name: Validate Template uses: hashicorp/packer-github-actions@master From 89c2875ac7f02e0cc1387d5c70ea5932a0497da0 Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen Date: Wed, 24 Aug 2022 15:44:05 -0500 Subject: [PATCH 7/7] Relocate packer repo --- .github/workflows/build-image.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index c7d225a2..c78d0a25 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -24,12 +24,12 @@ jobs: pip install ansible s3cmd - name: Clone packer repo run: | - git clone https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git ../packer-openstack-hpc-image + git clone https://gitlab.rc.uab.edu/rc/packer-openstack-hpc-image.git - - name: Check cwd + - name: Get packer variables file run: | - pwd - ls .. + cd packer-openstack-hpc-image + cp openstack.pkrvars.hcl{.example,} - name: Validate Template uses: hashicorp/packer-github-actions@master @@ -37,7 +37,7 @@ jobs: command: validate arguments: -syntax-only target: openstack - working_directory: ../packer-openstack-hpc-image + working_directory: packer-openstack-hpc-image - name: Build Artifact uses: hashicorp/packer-github-actions@master @@ -45,6 +45,6 @@ jobs: command: build arguments: "-color=false -on-error=abort" target: openstack - working_directory: ../packer-openstack-hpc-image + working_directory: packer-openstack-hpc-image env: PACKER_LOG: 1